|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
table A contains 1000 records table b contains 950 records.
unique key is order numner for both. now i want to list all the 1000 records which is match or unmatch with table a and table b the details will be 950 with matched and 50 with not matched how to write query. |
|
#2
|
||||
|
||||
|
Code:
SELECT a.order, a.anotherfield.... FROM A Left Join B on a.order=b.order The above will give you the all the records on table A. The code below will give you the unmatched records Code:
SELECT b.order, b.anotherfield..... FROM B Left Join A on B.order=A.order WHERE (A.order is Null) Don't forget to change b.anotherfield, and a.anotherfield to something else you have on your database. |
|
#3
|
|||
|
|||
|
select tab1.* from table1 tab1 left join table2 tab2 on tab1.orderno=tab2.orderno
|
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > sql query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|