我需要一些帮助才能正确构建此查询。我几乎输入了我想要做的事情。它不是最好的例子,但它是解释的开始。如果有人能指出我的方向是正确的那么好。
SELECT
entry_id,
author_id,
title,
status
FROM exp_channel_titles
WHERE title LIKE %Member Package%
AND status = 'complete'
LEFTJOIN
SELECT
entry_id,
field_id_14,
field_id_15,
field_id_25,
field_id_27,
field_id_28,
field_id_29,
field_id_30,
field_id_31,
field_id_32,
field_id_33,
field_id_34,
field_id_35
FROM exp_channel_data
WHERE entry_id = exp_channel_titles.entry_id
LEFTJOIN
SELECT
member_id,
email
FROM exp_members
WHERE member_id = exp_channel_titles.author_id
答案 0 :(得分:1)
SELECT
entry_id,
author_id,
title,
status
FROM exp_channel_titles
LEFT JOIN
(SELECT
entry_id,
field_id_14,
field_id_15,
field_id_25,
field_id_27,
field_id_28,
field_id_29,
field_id_30,
field_id_31,
field_id_32,
field_id_33,
field_id_34,
field_id_35
FROM exp_channel_data
WHERE entry_id = exp_channel_titles.entry_id)
LEFT JOIN
(SELECT
member_id,
email
FROM exp_members
WHERE member_id = exp_channel_titles.author_id)
WHERE title LIKE %Member Package%
AND status = 'complete'
答案 1 :(得分:1)
您可以LEFT JOIN
表格如此:
SELECT
t.entry_id, t.author_id, t.title, t.status
d.field_id_14, d.field_id_15, d.field_id_25, d.field_id_27, d.field_id_28, d.field_id_29,
d.field_id_30, d.field_id_31, d.field_id_32, d.field_id_33, d.field_id_34, d.field_id_35,
m.member_id, m.email
FROM exp_channel_titles t
LEFT JOIN exp_channel_data d on t.entry_id = d.entry_id
LEFT JOIN exp_members m on t.author_id = m.author_id
WHERE t.title LIKE %Member Package%
AND t.status = 'complete'