Order By
select
sum(DIGPONTOS_X) DIGPONTOS_X,
sum(DIGPONTOS_10) DIGPONTOS_10,
sum(DIGPONTOS_9) DIGPONTOS_9,
sum(DIGPONTOS_8) DIGPONTOS_8,
sum(DIGPONTOS_7) DIGPONTOS_7,
sum(DIGPONTOS_6) DIGPONTOS_6,
sum(DIGPONTOS_5) DIGPONTOS_5,
sum(DIGPONTOS_TOTAL) DIGPONTOS_TOTAL,
sum(DIGPONTOS_MEDIA) DIGPONTOS_MEDIA,
DIGPONTOS_CODATIRADOR
from DIGPONTOS
group by DIGPONTOS_CODATIRADOR
order by DIGPONTOS_TOTAL desc
Bom, gostaria de saber como posso fazer, ou concertar, um código que funcione de maneira igual ao aí de cima no MySQL. Este aí de cima não funciona corretamente. No Delphi 7, ocorre o seguinte erro com o código aí de cima:
Invalid expression in the ORDER BY clause (not contained in either an aggregate function or the GROUP BY clause)
Alguém sabe o que fiz de errado ou como fazê-lo funcionar?
Grato,
Tiago Hillebrandt
sum(DIGPONTOS_X) DIGPONTOS_X,
sum(DIGPONTOS_10) DIGPONTOS_10,
sum(DIGPONTOS_9) DIGPONTOS_9,
sum(DIGPONTOS_8) DIGPONTOS_8,
sum(DIGPONTOS_7) DIGPONTOS_7,
sum(DIGPONTOS_6) DIGPONTOS_6,
sum(DIGPONTOS_5) DIGPONTOS_5,
sum(DIGPONTOS_TOTAL) DIGPONTOS_TOTAL,
sum(DIGPONTOS_MEDIA) DIGPONTOS_MEDIA,
DIGPONTOS_CODATIRADOR
from DIGPONTOS
group by DIGPONTOS_CODATIRADOR
order by DIGPONTOS_TOTAL desc
Bom, gostaria de saber como posso fazer, ou concertar, um código que funcione de maneira igual ao aí de cima no MySQL. Este aí de cima não funciona corretamente. No Delphi 7, ocorre o seguinte erro com o código aí de cima:
Invalid expression in the ORDER BY clause (not contained in either an aggregate function or the GROUP BY clause)
Alguém sabe o que fiz de errado ou como fazê-lo funcionar?
Grato,
Tiago Hillebrandt
Tiagoscd
Curtidas 0
Respostas
Emerson Nascimento
20/02/2007
use:
order by 8 desc // oitavo campo da lista
ou
order by sum(DIGPONTOS_TOTAL) desc
order by 8 desc // oitavo campo da lista
ou
order by sum(DIGPONTOS_TOTAL) desc
GOSTEI 0
Tiagoscd
20/02/2007
porra
brigadão velho
hehehe
tudo por causa de um maldito campo
o/
valeu velho
tu salvou minha pele a tempo
te devo essa
abrass
brigadão velho
hehehe
tudo por causa de um maldito campo
o/
valeu velho
tu salvou minha pele a tempo
te devo essa
abrass
GOSTEI 0