查詢3個表,最後一個表有額外的行查找。
試過這樣:sql聯合不規則組合
(SELECT 't1' AS tn, navid, clicks AS cc, tags
FROM t1
WHERE DATE_ADD(d, INTERVAL '0 8' DAY_HOUR) <= NOW()
AND tags LIKE '%cars%')
UNION DISTINCT
(SELECT 't2' AS tn, navid, clicks AS cc, tags
FROM t2
WHERE DATE_ADD(d, INTERVAL '0 8' DAY_HOUR) <= NOW()
AND tags LIKE '%cars%')
UNION DISTINCT
(SELECT 't3' AS tn, navid, title, clicks AS cc, tags
FROM t3
WHERE DATE_ADD(d, INTERVAL '0 8' DAY_HOUR) <= NOW()
AND tags LIKE '%cars%')
我想獲得在T3
任何幫助的title
領域,由於