Subject | Re: [firebird-support] Help on this SQL statment |
---|---|
Author | Alexandre Benson Smith |
Post date | 2013-06-15T21:33:58Z |
Em 15/6/2013 16:54, Iwan Cahyadi Sugeng escreveu:
BY clause, as the others have said, but I think the ORDER clause should be:
SQLCommand = SQLCommand & "ORDER BY 3 DESC "
That way the result would be order by the Sum of ProductQty
see you !
> Change it into this syntax:The error will be corrected by the addition of ProductCode to the GROUP
>
> SQLCommand = vbNullString
>
> SQLCommand = SQLCommand & "SELECT "
>
> SQLCommand = SQLCommand & "PRODUCTCODE,"
>
> SQLCommand = SQLCommand & "PRODUCTDESCRIPTION,"
>
> SQLCommand = SQLCommand & "SUM(PRODUCTQTY),"
>
> SQLCommand = SQLCommand & "SUM(PRODUCTTOTAL) "
>
> SQLCommand = SQLCommand & "From ProductHistory "
>
> SQLCommand = SQLCommand & "WHERE PRODUCTDATE Between '" & StartDate & "'
> AND '" & EndDate & "' "
>
> SQLCommand = SQLCommand & "GROUP BY PRODUCTODE, PRODUCTDESCRIPTION "
>
> SQLCommand = SQLCommand & "ORDER BY PRODUCTQTY DESC "
>
> SQLCommand = SQLCommand & "ROWS 1 TO 25"
>
>
>
BY clause, as the others have said, but I think the ORDER clause should be:
SQLCommand = SQLCommand & "ORDER BY 3 DESC "
That way the result would be order by the Sum of ProductQty
see you !