CREATE TABLE IF NOT EXISTS m_tabale (
id bigint auto_increment,
m_code VARCHAR(6),
m_date DATE,
m_val VARCHAR(256),
primary key(id)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
m_code m_date m_val
000001 2023-01-01 wwwwww
000001 2023-01-02 weeeee
000001 2023-01-03 werrrr
000002 2023-01-01 weewww
000002 2023-01-02 wttwew
000003 2023-01-01 weewww
000003 2023-01-02 wttwew
000003 2023-01-03 wttwew
查询语句:
SELECT m_code, m_date
FROM m_tabale
GROUP BY m_code, m_date
HAVING COUNT(*) = 1;