acidburn Posted May 4, 2004 Posted May 4, 2004 i am trying to show info from two tables in a listview in vb.net, and the sql statement needs a left join statement to join the two tables. I need help with the code. PLEASE Quote
Denaes Posted May 4, 2004 Posted May 4, 2004 Quote i am trying to show info from two tables in a listview in vb.net, and the sql statement needs a left join statement to join the two tables. I need help with the code. PLEASE Do you have MS Access? Without trying to sidestep, that is by far the easiest way to learn these things. You make your query in design view and right click and choose SQL. MSDE probobly wouldn't have these features, but SQL Server XXXX better damn well have them for that price! Here is what I got from access for a two table showing One to Many: SELECT FROM <OneTable> INNER JOIN <ManyTable> ON <OneTable.Key> = <ManyTable.ForeignKey>; Hope that helps a little. Quote
JABE Posted May 4, 2004 Posted May 4, 2004 Quote SELECT FROM <OneTable> INNER JOIN <ManyTable> ON <OneTable.Key> = <ManyTable.ForeignKey>; You should probably change INNER JOIN to LEFT OUTER JOIN (since that's what was required in the original post). And, of course, don't forget the field list following the SELECT clause. Quote
Denaes Posted May 4, 2004 Posted May 4, 2004 What's the difference between LEFT INNER JOIN and INNER JOIN? Quote
akiaz Posted May 4, 2004 Posted May 4, 2004 Quote What's the difference between LEFT INNER JOIN and INNER JOIN? There is not such thing as a LEFT INNER JOIN, just INNER JOIN or simply JOIN. Only OUTER joins have a directional keyword like LEFT, RIGHT or FULL and the SQL-92 standard defines these keywords as equivalent: LEFT OUTER JOIN or LEFT JOIN RIGHT OUTER JOIN or RIGHT JOIN FULL OUTER JOIN or FULL JOIN Then there are cross joins also known as cartesian products, like when you just specify the tables without indicating a join like this: SELECT * FROM tableone, tabletwo HTH Quote
JABE Posted May 5, 2004 Posted May 5, 2004 Quote What's the difference between LEFT INNER JOIN and INNER JOIN? From SQL Server Books Online: "Inner joins return rows only when there is at least one row from both tables that matches the join condition. Inner joins eliminate the rows that do not match with a row from the other table. Outer joins, however, return all rows from at least one of the tables or views mentioned in the FROM clause, as long as those rows meet any WHERE or HAVING search conditions. All rows are retrieved from the left table referenced with a left outer join, and all rows from the right table referenced in a right outer join. All rows from both tables are returned in a full outer join" And as mentioned by akiaz, there's no such thing as a LEFT INNER JOIN. Quote
Denaes Posted May 5, 2004 Posted May 5, 2004 Quote And as mentioned by akiaz, there's no such thing as a LEFT INNER JOIN. Yeah, my mistake. I misread what you wrote. I thought you wrote that my INNER JOIN was wrong, but should be LEFT INNER JOIN. You wrote LEFT OUTER JOIN. I should stick my nose out of things I don't understand really. I thought he just ment "Join" and was trying to help. Sorry :( Quote
pelikan Posted May 28, 2004 Posted May 28, 2004 MSDE2000 is SQL Server 2000 with limited concurrency and no interface. It has the full power of T-SQL. Quote IN PARVUM MULTUM
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.