mysql - number of rows in a stored procedure -


is possible conditional select based on number of rows in stored procedure?

e.g. if select * table1 has no records, select * table2?

try this:

select col1, col2, ..., coln table1 union select col1, col2, ..., coln table2 not exists (select * table1) 

this of course assumes both tables have same structure.


Comments

Popular posts from this blog

python - Why doesn't list have safe "get" method like dictionary? -

razor - Is this a bug in WebMatrix PageData? -

sql server - Stored procedure -