更新时间:2022-06-22 10:22:01
SELECT
ID,
ParentID,
DataValue
FROM
MyTable
WHERE
NOT EXISTS (
SELECT 1
FROM MyTable i
WHERE i.ParentId = MyTable.ParentId AND i.DataValue = 'A'
)
如果表很大,建议使用 (ParentId, DataValue)
上的索引.
An index over (ParentId, DataValue)
is recommendable if the table is large.