(SELECT *, 0 AS user FROM table1)
UNION
(SELECT * FROM table2 WHERE unix >= {$threemonths})
ORDER BY unix DESC;
我需要添加:
WHERE table2.identifier = table1.identifier
或其他什么
我希望从table1
获取所有内容,并且只有来自table2
identifier
table1
列identifier
中else
的{{1}}行。< / p>
答案 0 :(得分:2)
请查看这是否适合您
(SELECT *, 0 AS user FROM table1)
UNION
(SELECT * FROM table2 WHERE unix >= {$threemonths} and exists (select 'Y' from table1 a where a.identifier = table2.identifier))
ORDER BY unix DESC;
答案 1 :(得分:0)
可能是
{{1}}