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

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -