所以在这种情况下,我希望过滤器买方仅在2019年的(jan,feb,mar)出现,并在2017年的(apr,may,june)出现,这是我的语法
SELECT DISTINCT
d1.buyer_id,
d1.tgl
FROM data_2019 d1
INNER JOIN data_2017 d2
ON d1.buyer_id = d2.buyer_id
INNER JOIN data_2017 d3
ON d1.buyer_id = d3.buyer_id
INNER JOIN data_2018 d4
ON d1.buyer_id = d4.buyer_id
INNER JOIN data_2019 d5
ON d1.buyer_id = d5.buyer_id
WHERE
MONTH(d1.tgl) IN (7, 8, 9) AND
MONTH(d2.tgl) IN (4, 5, 6) AND
MONTH(d3.tgl) NOT IN (1, 2, 3, 7, 8, 9, 10, 11, 12) AND
MONTH(d4.tgl) NOT IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) AND
MONTH(d5.tgl) NOT IN (1, 2, 3, 4, 5, 6, 10, 11, 12) group by buyer_id;
但是那是错误的,你知道哪里出问题了吗?