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)
 Simple - if statement

Author  Topic 

staticbob
Yak Posting Veteran

99 Posts

Posted - 2006-02-01 : 08:03:08
Hi,

I have this SQL view, both tables have a field "InspectionAreaName", I would only like to return the value from the IA table join field if the value in the IR table is null.

Could somebody help please ?
Thanks
Bob

SELECT

ir.*,
ia.name as InspAreaName

FROM
InspectionRecord ir
join
inspectionarea ia on ia.id = ir.inspectionarea

"I dislilke 7am. If &am were a person, I would kick 7am in the biscuits." - Paul Ryan, dailyramblings.com

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-02-01 : 08:10:05
something like this ?
isnull(ir.col1, ia.col1)


----------------------------------
'KH'


Go to Top of Page

staticbob
Yak Posting Veteran

99 Posts

Posted - 2006-02-01 : 08:15:26
Exactly that, thankyou.

"I dislilke 7am. If &am were a person, I would kick 7am in the biscuits." - Paul Ryan, dailyramblings.com
Go to Top of Page
   

- Advertisement -