Subject Re: help with a select, i m out of ideas.
Author Adam
>
> SELECT FIRST 20 SUM(V.vnd_total) as TOTAL,
> (SELECT SUM(I.item_qtde) FROM items_venda I WHERE
I.vnd_cod=V.vnd_cod) AS
> QTDE,
> C.cli_nome FROM VENDAS V
> JOIN clientes C ON (C.cli_cod=V.cli_cod)
> WHERE V.vnd_data BETWEEN '2006-03-01' AND '2006-03-31'
> GROUP BY C.cli_nome, V.vnd_cod
> ORDER BY SUM(I.item_qtde) DESC
>
> Dynamic SQL Error SQL error code = -206 Column unknown I.ITEM_QTDE
At line
> 10, column 21.
>
> I tried ORDER BY QTDE, but it didnt work, is there any way to do this?

Use the field position syntax for order by

'Order By [Field Position in select]'

In this case,

ORDER BY 2 DESC

Adam