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 |
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-08-26 : 12:06:41
|
| I have 2 tables..Table 1 School...Table 2 SchoolUsers. I want to join the 2 tables and bring back all schools. In the SchoolUsers table there is a bit field that is "SchoolSiteMainContact"... Some schools may or may not have a main contact or maybe they don't have any users, but I still want to bring back all the schools. Here is my shot at it. It does not workSELECT SchoolSite.ID, SchoolSite.School, SchoolSiteUser.SchoolSiteEmailFROM SchoolSite LEFT OUTER JOIN SchoolSiteUser ON SchoolSite.ID = SchoolSiteUser.SchoolSiteIDWHERE (SchoolSiteUser.SchoolSiteMainContact = 1)DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
ramireddy
Starting Member
4 Posts |
Posted - 2009-08-26 : 12:31:14
|
| change your where clause to where SchoolSiteUser.SchoolSiteMainContact = 1 or SchoolSiteUser.SchoolSiteMainContact is null |
 |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2009-08-26 : 12:33:18
|
| You need to understand this and the related links:http://blog.sqlauthority.com/2009/04/06/sql-server-logical-query-processing-phases-order-of-statement-execution/ |
 |
|
|
|
|
|