[thelist] SQL Challenge Question

Paul Cowan evolt at funkwit.com
Wed Oct 29 00:31:03 CST 2003

Rob Smith wrote:
> Thanks Jay. I've done all that. Rudy and I've been going back and forth on
> this [off list] and he gave me:

I'm sure rudy would have mentioned this, being rudy, but be careful:

>      , case when P1.ProjectOwner
>               <> P2.ProjectOwner
>             then '*' else ' ' end as ProjectOwner

this won't behave as expected when either P1.ProjectOwner or
P2.ProjectOwner is null.

If ProjectOwner is null in one row, and 'Fred' in another row, then
you won't get an asterisk here; you'll get a space.

If you have nullable columns, you'll need to be a little bit more tricky
with your query.



More information about the thelist mailing list