开发者

SQL query help in where clause

开发者 https://www.devze.com 2023-01-25 12:16 出处:网络
string sql1 = \"selectjname, jcode from heardt,judge,main where heardt.jud1 = judge.jcode and main.fil_no=heardt.fil_no and ..
string sql1 = "select  jname, jcode 

from heardt,judge,main 

where heardt.jud1 = judge.jcode and main.fil_no=heardt.fil_no and ..

 main.fil_no= ";

I have a form in which user enters a reg_no on entering reg_no only name and address is displayed, in the same tab开发者_C百科le there is fil_no which i want to be used in my above query to link to another table.

how can i specify it in my above query,in the third AND condition? please guide me.


You are talking about JOINing tables I believe? Joins are very simple and are written as thus :-

SELECT t1.column1,t1,column2,t2.column1,t2.column2 FROM table1 t1 JOIN table2 t2 ON t1.key1 = t2.key1 WHERE .....

You can join as many tables as you require and have multiple JOIN types. See more here :- http://msdn.microsoft.com/en-us/library/ms191472.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消