我有这个查询:
SELECT A, B, C
FROM ( SELECT
lla.id as A,
max(decode(lla.attrid, 2, lla.valstr, null)) as B,
max(decode(lla.attrid, 3, lla.valstr, null)) as C
FROM
llattrdata lla,
llattrdata lla2
WHERE
lla.id = lla2.id
GROUP BY lla.id)
WHERE C = "Yes"
有一个更好的方法吗?我尝试使用 HAVING 子句,但无法使其对列 C="Yes" 起作用。提前致谢。