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
Post a Comment