Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
shoham
Starting Member
6 Posts |
Posted - 2011-11-23 : 08:59:30
|
| hello all,i have a qury somthig like this:select a.*,b.field1 from tbl_a as a join tbl_b as b on a.id=b.idnow tbl_a contains 10 records, but only 7 of them exist in tbl_b,so when i join them together i get only 7 records.how can i make the query to get the whole 10 records with null value in "field1"thanksShoham |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-11-23 : 09:30:18
|
change the join to LEFT JOINselect a.*,b.field1from tbl_a as aLEFT join tbl_b as bon a.id=b.id KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
shoham
Starting Member
6 Posts |
Posted - 2011-11-23 : 09:36:49
|
thanks ! |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-11-23 : 09:37:20
|
welcome KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|