|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How can I Write a sql statement that displays all records from table Table1 joined to Table2 where column id in Table1 is equal to column tempid in Table2.
|
|
#2
|
|||
|
|||
|
Hi Alex196,
You can simply write: Select * From Table1 INNER JOIN Table2 ON Table2.tempid = Table1.id This will give all the matching records from both the tables. If you want all the records from Table1 irrespective of whether or not there is a matching record in Table2, then you can write: Select * From Table1 LEFT OUTER JOIN Table2 ON Table2.tempid = Table1.id Regards, Vikram |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > how can I Write a sql statement that displays all records from table Table1 joined to |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|