I am doing a select using CASE WHEN
in Sql Server, so it is done checking the existence of a record, if it exists, it makes select in a table, otherwise it makes select in another table, however, the two can return null. Something like this:
CASE WHEN EXISTS(SELECT Id FROM TabelaA WHERE ColA = 10)
THEN
(SELECT ColA from TabelaA WHERE ColA = 10)
ELSE
(SELECT ColA from TabelaB WHERE ColB = 10)
END Column
How to use a ISNULL
in this script to avoid a null return of both selects?