我有
select CustID,
case permission
When 'read' then 'X'
end as 'Read',
case permission
when 'write' then 'X'
end as 'Write',
case permission
when 'own' then 'X'
end as 'Own',
case permission
when ‘destroy’ then ‘X’
end as ‘Destroy’
from rights
group by custID, permission
我只想为每个 custID 写一行。相反,我得到:
CustID | Read | Write | Own | Destroy
208345482 X NULL NULL NULL|
208345482 NULL NULL X NULL|
208345482 NULL NULL NULL X|
208345482 NULL X NUL NULL|
8093657522 NULL NULL NULL X|
8093657522 NULL NULL X NULL|
我试图按别名子查询分组,但无济于事。任何帮助将不胜感激。