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 |
|
ismailc
Constraint Violating Yak Guru
290 Posts |
Posted - 2008-11-24 : 07:29:10
|
| Hi, I need help please. I need to test if a certain id is in a table, if it is I want to return 1 row with value = 'Yes' else 'No'But i'm struggling to da a case on no results returned: select case when Role.Description = '' then 'No' else 'Yes' end as Description from dbo.fcUserGroup UserID left join dbo.fcRoleGroup Role on UserID.RoleGroupID = Role.ID where Role.Name = 'RD NFG' and UserID.RoleID = 69Regards |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-24 : 07:32:36
|
do you mean this?SELECT case when(select count(*) from dbo.fcUserGroup UserID left join dbo.fcRoleGroup Role on UserID.RoleGroupID = Role.ID where Role.Name = 'RD NFG' and UserID.RoleID = 69) =0 then 'No' else 'Yes' end as Description |
 |
|
|
ismailc
Constraint Violating Yak Guru
290 Posts |
Posted - 2008-11-24 : 08:02:47
|
| Thank You - this is great!!! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-24 : 08:39:39
|
Welcome |
 |
|
|
|
|
|