I need a way to force a NULL value to return in a simple query instead of just an empty result set if the "where" clause does not yield any results.
Example . . .
Table A Table B
NameColumn char (15) StreetColumn char (20)
NumberColumn int NumberColumn int
IdColumn int AcctColumn int
Table "A" and table "B" are joined on "NumberColumn".
My query looks like this .......
The problem is, if TableB does not contain a record for AcctColumn 123456 then I am just getting back an empty result set. I actually want a NULL return so I can default the return to the caller something like "Not Found" without having to look at the row count.
I am doing this in batch to a report so it's not inline or on request. I could have many rows in Table "A" without a matching row in Table "B". This data is going to a report so I need some way to tell the user of the report that the corresponding data is not found in table "B".
Ideas? Suggestions?
Thanks.
Stay Cool Ya'll!![[smile2] [smile2] [smile2]](/data/assets/smilies/smile2.gif)
-- Kristin
Example . . .
Table A Table B
NameColumn char (15) StreetColumn char (20)
NumberColumn int NumberColumn int
IdColumn int AcctColumn int
Table "A" and table "B" are joined on "NumberColumn".
My query looks like this .......
Code:
select NameColumn
from TableA MyA
inner join TableB MyB on
MyB.AcctColumn = 123456
where MyA.NumberColumn = MyB.NumberColumn
The problem is, if TableB does not contain a record for AcctColumn 123456 then I am just getting back an empty result set. I actually want a NULL return so I can default the return to the caller something like "Not Found" without having to look at the row count.
I am doing this in batch to a report so it's not inline or on request. I could have many rows in Table "A" without a matching row in Table "B". This data is going to a report so I need some way to tell the user of the report that the corresponding data is not found in table "B".
Ideas? Suggestions?
Thanks.
Stay Cool Ya'll!
![[smile2] [smile2] [smile2]](/data/assets/smilies/smile2.gif)
-- Kristin