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
 SQL Server Development (2000)
 useful IsNull statement

Author  Topic 

daniel.newman@bis-web.net
Yak Posting Veteran

71 Posts

Posted - 2001-07-06 : 12:27:19
Hello all,

I'm trying to return a select statement, and I want to add an isnull into the select, but I want the returned value to be another field within the database.

The follwoing statement doesn't work, so is there another way of writing it to make it work?

SELECT TOP 6 X.Code, IsNull(X.Title,(SELECT PP.title FROM PowerpointPresentations PP WHERE PP.Code = X.Code)) AS Title, AppearanceDate FROM WebCastTable AS X WHERE X.AppearanceDate < 'Jul 6 2001 5:16PM' AND X.LiveOrNot = 1 ORDER BY X.ReleaseDate DESC, X.Title

For info:

X.Title will only ever be NULL in one situation, and when it happens, I want to add the title of the referenced Powerpoint Presentation. Would a left join work better for me in this case?

Any help will be useful,

Thanks,
Daniel Newman.

   

- Advertisement -