Re: Infomix SQL help needed
Posted in 1998
Sam Glattstein wrote:
>
> I am running INFORMIX SQL Version 2.0 (its old but it does the job well)
>
> In the report that is output below Customers (cusid) sell 1 product
> (selpr) per row which is either E, R, S, or
> Others (which <> E, R, or S). The report then totals each row, (group
> total of (selpr)) E, R, S, and Others per (cusid) along with their
> (group count).
>
> I am trying to change the **order by** output of the report from cusid
> to **group total of (selpr)** which is the far right column on the
> report (the sum of group totals of E, R, S, and Others). The report
> should look the same, but order by Totals.
>
> I have tried all combinations in "order by" but can not get the report
> to compile.
Change the SQL to select GROUP BY selecting the SUM() and COUNT() and
ORDER BY the summary column using the column number syntax. Since you
do not report detail anyway this will work and may be faster:
select selpr, cusid, sum(dsold), clr -- you do not report qques so I
from inventory -- dropped it.
where
....
group by 1, 2, 4
order by 1, 3
Art S. Kagel