表结构:
SELECT p.id id, p.type
TYPE , v.provider provider, v.video_id video_id, NULL content, NULL url, NULL posted_by
FROM post p
INNER JOIN p_video v ON p.id = v.id
AND p.type = 'video'
UNION
SELECT p.id, p.type, NULL , NULL , t.content, NULL , NULL
FROM post p
INNER JOIN p_text t ON p.id = t.id
AND p.type = 'text'
UNION
SELECT p.id, p.type, NULL , NULL , NULL , i.url, NULL
FROM post p
INNER JOIN p_image i ON p.id = i.id
AND p.type = 'image'
UNION
SELECT p.id, p.type, NULL , NULL , NULL , l.url, NULL
FROM post p
INNER JOIN p_link l ON p.id = l.id
AND p.type = 'link'
UNION
SELECT p.id, NULL , NULL , NULL , NULL , NULL , u.name
FROM post p
LEFT JOIN user u ON p.user_id = u.id
ORDER BY id DESC
LIMIT 0 , 30
我的语法错误是什么?它只做 2 行.. 但我希望所有输出都在单独的 1 行中。