sql - SELECT based on the result of another SELECT -
is possible run select based on result of first select?
for example:
select count(*) table1 if result 0, want display result of:
select a, b, c table2 if result of first select not 0, display result of first query , ignore second.
you can run second select based on results of first:
you this:
declare @count integer = (select count(*) table1) if @count = 0 select ... table1 else select ... table2
Comments
Post a Comment