Subject Re: [firebird-support] How to return the value of a sub-query as a field in the resulting table
Author Alexandre Benson Smith
Em 7/4/2011 17:07, cornievs escreveu:
> Select A.CLIENT, B.NAME, SUM(A.POINTS) FROM POINTS A JOIN CLIENTS B ON A.CLIENT = B.CODE WHERE A.PROMOTION = 3 GROUP BY A.CLIENT

every filed that is not an aggregate must be in the group list.

Select A.CLIENT, B.NAME, SUM(A.POINTS) FROM POINTS A JOIN CLIENTS B ON A.CLIENT = B.CODE WHERE A.PROMOTION = 3 GROUP BY A.CLIENT, B.Name order by A.Client
Select A.CLIENT, B.NAME, SUM(A.POINTS) FROM POINTS A JOIN CLIENTS B ON A.CLIENT = B.CODE WHERE A.PROMOTION = 3 GROUP BY A.CLIENT, B.Name order by B.Name
Select A.CLIENT, B.NAME, SUM(A.POINTS) FROM POINTS A JOIN CLIENTS B ON A.CLIENT = B.CODE WHERE A.PROMOTION = 3 GROUP BY A.CLIENT, B.Name order by 3

see you !