可以,不过效率不高。如:
select 字段 from 表名1 where 条件
union
select 字段 from 表名2 where 条件
改为以下:
select *
from
(
select 字段
from 表名1
union
select 字段
from 表名2
) as A
where 条件
转载请注明:有客帮 » 用union连接两个语句,可以用共同where条件吗
可以,不过效率不高。如:
select 字段 from 表名1 where 条件
union
select 字段 from 表名2 where 条件
改为以下:
select *
from
(
select 字段
from 表名1
union
select 字段
from 表名2
) as A
where 条件
转载请注明:有客帮 » 用union连接两个语句,可以用共同where条件吗