Select to return value if no records found
944151Jun 17 2012 — edited Jun 17 2012Hi All,
First of all apologies for such question but I consider myself as rookie in creating any kind of queries.
Still - this will definitely help my case so I'd really appreciate your help.
And.. moving back to the point :)
Having following table:
UserID REC_TYP REC_CD
12345 'OFFR' 12
23456 'MSG' 13
I'd like to construct the query which in this particular case would return the REC_CD as 'Record_ID' for REC_TYP='OFFR' where USERID=? (always fetched by the application) and if such USER_ID doesn't exists (for the particular REC_TYP of course) to return string or any other value.
e.g.
The result for this query in case of user_id 23456 = would be "doesn't exist" or sth for instance 'FALSE' and for 123456 it would be '12'
Many thanks in advance