Join
-
I want to join 5 tables and in that way get returned a schema of 10 columns that I can fetch with a recordset that I have made in C++ for this reason, but if one or more of the tables are empty (with this ID) the returned schema doesn't get 10 columns (or doesn't come at all depending on how you do it) and so I cant fetch it with my recordset. I want those column empty if the row is not there. I know I can declare variables like: select chvName = '' from Person but I dont know if it is empty when I do my sql-string without checking that first. Anybody that is good at Transact-SQL? Robert
-
I want to join 5 tables and in that way get returned a schema of 10 columns that I can fetch with a recordset that I have made in C++ for this reason, but if one or more of the tables are empty (with this ID) the returned schema doesn't get 10 columns (or doesn't come at all depending on how you do it) and so I cant fetch it with my recordset. I want those column empty if the row is not there. I know I can declare variables like: select chvName = '' from Person but I dont know if it is empty when I do my sql-string without checking that first. Anybody that is good at Transact-SQL? Robert
Select A.Column1, B.Column1 From tblA A, tblB B WHERE A.Column1 *= B.Column1 If B.Column1 does not exist you will return A.Column1's Value and Null for B.Column1's Value. The *= or =* is the same as an inner or outer join in T-SQL. Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)
-
Select A.Column1, B.Column1 From tblA A, tblB B WHERE A.Column1 *= B.Column1 If B.Column1 does not exist you will return A.Column1's Value and Null for B.Column1's Value. The *= or =* is the same as an inner or outer join in T-SQL. Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)
Thank you very much, now it works!
-
Select A.Column1, B.Column1 From tblA A, tblB B WHERE A.Column1 *= B.Column1 If B.Column1 does not exist you will return A.Column1's Value and Null for B.Column1's Value. The *= or =* is the same as an inner or outer join in T-SQL. Michael I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)
*= and =* are the same as LEFT JOIN and RIGHT JOIN, no? And I don't think they're supported any more, Microsoft's reason being that they're not in the SQL-92 standard. I'd counsel a newbie to use left and right joins instead. Regards, Jeff Varszegi