我正在尝试将 2 个选择语句与不同的列数结合起来。
第一个声明是这样的:
SELECT s.id, s.date_sent, m.sam_subject, m.sam_msg_id, (SELECT
COUNT(id) FROM tbl_something WHERE schedule_id = s.id) AS
total_recipients FROM tbl_something2 AS s INNER JOIN
tbl_something3 AS m ON s.message_id = m.sam_msg_id ORDER BY
s.date_sent DESC
第 2 条声明:
SELECT * FROM sms_something4 WHERE status = '0' ORDER BY id DESC
第一条语句的表输出:
id date_sent sam_subject sam_msg_id total_recipients
1 1372880628 e-Newsletter 2 2
第二次输出:
id | subject | sent | failed | date_sent | data_sent | data_failed | message | sam_uid from | select_members | status | from_no
11 | test | 2 | 0 | 1372881670 | 639176286411,639224588324 | | | | | | 0 | 0
关于如何将这两个陈述结合起来的任何建议?
我的目标输出是
id | subject | sent | failed | date_sent | sam_subject | total_recipients | date_sent for email
sam_msg_id
可以忽略。
谢谢你。