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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Name not found then give value

Author  Topic 

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2007-03-13 : 12:55:07

Been trying to get this one but need a little input.

SELECT a.Id,
g.LabName......

FROM someTbl a,
table g

WHERE a.id = @id
AND (b.calLab = g.ID OR g.LabName = ???)

With the above, if b.calLab = 0 then there is no entry in table g.
(I didn't develop the table or would have included NONE)

So, how to tell g.LabName to come back as 'None' if b.calLab = 0?

Thanks,

Zath

Zath
Constraint Violating Yak Guru

298 Posts

Posted - 2007-03-13 : 14:23:43
Ok, got it.

Added a case statement in the select portion then a distinct
and it all worked.


Zath
Go to Top of Page
   

- Advertisement -