如何根據(jù)多個條件分組?
selectrecdate,sum(a1)from表1whereflag=0groupbyrecdate
unionall
selectrecdate,sum(a12)from表2groupbyrecdate
如果不是你想要的,可以這樣:
selectrecdate,sum(a1)
from(selectrecdate,a1from表1whereflag=0
unionall
selectrecdate,a12from表2)b
groupbyrecdate
如何根據(jù)多個條件分組?
selectrecdate,sum(a1)from表1whereflag=0groupbyrecdate
unionall
selectrecdate,sum(a12)from表2groupbyrecdate
如果不是你想要的,可以這樣:
selectrecdate,sum(a1)
from(selectrecdate,a1from表1whereflag=0
unionall
selectrecdate,a12from表2)b
groupbyrecdate