以下代码编译出错,求教:
select uNAME,sum(
case uScore
when 'Win' then 1
else 0
end)as WINsum(
case uScore
when 'Lose' then 1
else 0
end)as LOSEfrom uGame
group by uNAME如果只生产单列,则编译正确,如下:
select uNAME,sum(
case uScore
when 'Win' then 1
else 0
end)as WINfrom uGame
group by uNAME
select uNAME,sum(
case uScore
when 'Win' then 1
else 0
end)as WINsum(
case uScore
when 'Lose' then 1
else 0
end)as LOSEfrom uGame
group by uNAME如果只生产单列,则编译正确,如下:
select uNAME,sum(
case uScore
when 'Win' then 1
else 0
end)as WINfrom uGame
group by uNAME
select uNAME,sum(
case uScore
when 'Win' then 1
else 0
end)as WINsum(
case uScore
when 'Lose' then 1
else 0
end)as LOSEfrom uGame
group by uNAME上面代碼少了一個逗號,試一下下面的sqlselect uNAME,
sum(
case uScore
when 'Win' then 1
else 0
end) as WIN,
sum(
case uScore
when 'Lose' then 1
else 0
end)as LOSE
from uGame
group by uNAME
case uScore
when 'Win' then 1
else 0
end)as WIN
,
sum(
case uScore
when 'Lose' then 1
else 0
end)as LOSEfrom uGame
group by uNAME
你少放了一个逗号
还是只是贴少了报什么错呢