问这样得到的表能放在from后吗? 比如: Select ...from (SELECT a FROM table_name WHERE a=10 AND B=1 ORDER BY a LIMIT 10) UNION (SELECT a FROM table_name WHERE a=11 AND B=2 ORDER BY a LIMIT 10) ORDER BY a
啊?! 可是我想从这个union生成的表中查找啊!!
select * from tableA,tableB where tableA.id=1 or tableB.id=1 不知道mysql能用否?
tableA结构: id, name, age, sex, citytableB结构: id, name, ageSelect id, name, age, sex, city From tabelA Where id=1 Union Select id, name, age, '' as sex, '' as city From tableB Where id=1
from tableA
union
select *
from tableB
比如:
Select ...from (SELECT a FROM table_name WHERE a=10 AND B=1 ORDER BY a LIMIT 10)
UNION
(SELECT a FROM table_name WHERE a=11 AND B=2 ORDER BY a LIMIT 10)
ORDER BY a
可是我想从这个union生成的表中查找啊!!
不知道mysql能用否?