根据条件的不同,查询不同的表,能在from中判断实现吗?
我现在使用的是select * from (select * from table1 where 'a' in ('a','b') union all (select * from table1 where 'a' in ('c','d'))),但是这样做速度很慢,用不上索引,能在from 直接判断吗?
SQL写错了,是select * from (select * from table1 where 'a' in ('a','b') union all (select * from table2 where 'a' in ('c','d'))),