Subject | Help on this SQL statment |
---|---|
Author | Andrew gable |
Post date | 2013-06-15T16:54:51Z |
Hi everyone,
Can someone please advise me as to what is happing with this SQL Select
statement I am trying to use
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 PRODUCTDESCRIPTION "
SQLCommand = SQLCommand & "ORDER BY PRODUCTQTY DESC "
SQLCommand = SQLCommand & "ROWS 1 TO 25"
I am getting the following error
-2147467259 - [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code =-104
Invalid expression in the select list (not contained in either an aggregate
function or the GROUP BY clause)
If someone could explain that to me I would be most greatful.
[Non-text portions of this message have been removed]
Can someone please advise me as to what is happing with this SQL Select
statement I am trying to use
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 PRODUCTDESCRIPTION "
SQLCommand = SQLCommand & "ORDER BY PRODUCTQTY DESC "
SQLCommand = SQLCommand & "ROWS 1 TO 25"
I am getting the following error
-2147467259 - [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code =-104
Invalid expression in the select list (not contained in either an aggregate
function or the GROUP BY clause)
If someone could explain that to me I would be most greatful.
[Non-text portions of this message have been removed]