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 |
|
rlull
Starting Member
39 Posts |
Posted - 2007-06-19 : 12:44:33
|
| Here is my current select statement:SELECT Documents.*, Categories.Category, PlayerRoles.RoleName, Players.FirstName + ' ' + Players.LastName as PlayerNameFROM DocumentsJOIN CategoriesON Documents.CatId = Categories.CatIdJOIN PlayerRolesON Documents.RoleId = PlayerRoles.RoleIdJOIN PlayersON Documents.PlayerId = Players.PlayerIdWHERE Documents.DocId = 13ORDER BY Documents.DocNameHowever, sometimes there is not a PlayerId (which means no PlayerName either) associated with a document so I need to be able to skip the Players JOIN if the PlayerId = 0. How do I do this? Thanks. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-06-19 : 12:45:54
|
| only with properly parametrized dynamic sql.or have another procedure._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
cvraghu
Posting Yak Master
187 Posts |
Posted - 2007-06-19 : 13:09:53
|
| Use Outer join on Player related tables to fetch record from other tables even when player id is 0. |
 |
|
|
|
|
|