我不能update
或insert
;我只能CCD_ 3。到目前为止,我拥有的是
SELECT
m.id AS "Customer #", m.email AS "Email", p.purchased AS "Made Purchase"
FROM customer.profile AS m
LEFT JOIN customer.purchased AS p ON p.id = m.id
WHERE p.status = "SUCCESS"
GROUP BY m.id
customer.profile
表结构为:
id | 电子邮件 |
---|---|
1 | @gmail.com |
2 | 行 |
3 | 行 |
4 | 行 |
5 | 行 |
我怀疑您想要:
SELECT m.id as customer_number, m.email AS email,
(p.id IS NOT NULL) AS made_purchase
FROM customer.profile m LEFT JOIN
customer.purchased p
ON p.id = m.id AND p.status = 'SUCCESS'
GROUP BY m.id