I am sorry I Really do not understand :( -----Original Message----- From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com] On Behalf Of Nagy Szilveszter Sent: 15 June 2013 5:57 PM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] Help on this SQL statment
GROUP BY PRODUCTDESCRIPTION there is PRODUCTCODE missing here if you use aggregate functions u have to add all fields to GROUP BY that are not used with aggregate functions ________________________________ From: Andrew gable <andrew.ga...@tesco.net> To: firebird-support@yahoogroups.com Sent: Saturday, June 15, 2013 7:54 PM Subject: [firebird-support] Help on this SQL statment 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] [Non-text portions of this message have been removed] ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Yahoo! Groups Links ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3345 / Virus Database: 3199/6413 - Release Date: 06/15/13