Query.
-
I am doing a project in .net c# 2.0 with sqlserver2005 i have a listbox in the form in which i need to display some data from database. i need to get the loginnames of those clients who have levelid= 2 and 3, and who r logged in. For levelid and logindatetime are stored in 2 different tables 'login' and 'dealerlogin' respectively. Now to get his data i queried (in sqlserveranalyzer): select loginname from login as a, dealerlogin as b where ((b.levelid = 2) or (b.levelid = 3)) AND ((a.logindatetime is not null) and (a.logoutdatetime is null)) But there is some error. There is some problem in joining the 2 diff. clauses of 2 diff. tables. How can i do this? Hope to get a reply. regards nekshan.
-
I am doing a project in .net c# 2.0 with sqlserver2005 i have a listbox in the form in which i need to display some data from database. i need to get the loginnames of those clients who have levelid= 2 and 3, and who r logged in. For levelid and logindatetime are stored in 2 different tables 'login' and 'dealerlogin' respectively. Now to get his data i queried (in sqlserveranalyzer): select loginname from login as a, dealerlogin as b where ((b.levelid = 2) or (b.levelid = 3)) AND ((a.logindatetime is not null) and (a.logoutdatetime is null)) But there is some error. There is some problem in joining the 2 diff. clauses of 2 diff. tables. How can i do this? Hope to get a reply. regards nekshan.
How are the two tables related? You are missing a part of your where clause, the part where you must specify a.[Some Column] = b.[Some Column]