我有 2 个单独运行的 sql 查询,我想做的是合并两者,这样我就可以在一个查询中提取两组数据。
查询使用的是 ExpressionEngine 查询模块,如下所示,我想在一个查询中提取 total 和 total_2 :
查询一:
SELECT COUNT(exp_channel_data.entry_id) AS total
FROM exp_channel_data
JOIN exp_channel_titles
ON exp_channel_titles.entry_id = exp_channel_data.entry_id
WHERE field_id_207 != ''
AND status = 'open'
AND exp_channel_data.channel_id = '18'
AND author_id = "CURRENT_USER"
查询 2:
SELECT COUNT(exp_channel_data.entry_id) AS total_2
FROM exp_channel_data
JOIN exp_channel_titles
ON exp_channel_titles.entry_id = exp_channel_data.entry_id
WHERE status = 'open'
AND exp_channel_data.channel_id = '18'
AND author_id = "CURRENT_USER"