MySQL Forums
Forum List  »  Newbie

invalid use of group by
Posted by: Ryan McLean
Date: July 14, 2005 10:13AM

Hi all,

This is my first post, so please let me know if I do something incorrectly :) I am also brand new to mySQL . . .

I have the following query:

SELECT CLAIMPOLICYNUMBER AS Plan, PROVIDERSPECIALTY AS Specialty, TINNUM AS Tin, SUBTINSEQNUM AS SibTin, CHARGETYPECATEGORY AS ChargeCategory, SUM(BILLEDCHARGE) AS Billed, SUM(PAID) AS Paid, " + _
COUNT(DOCUMENTNUM) AS ChgCount
FROM BAT
WHERE CASENUM='0000911'
AND CHARGETYPE <> 'DENTAL' AND CHARGETYPE <> 'VISION' AND CHARGETYPE <> 'ADMIN'
AND PMTDATE >= '2005-06-01' AND PMTDATE <= '2005-06-30'
GROUP BY CLAIMPOLICYNUMBER, PROVIDERSPECIALTY, TINNUM, SUBTINSEQNUM, CHARGETYPECATEGORY
ORDER BY SUM(BILLEDCHARGE)

It works great without the ORDER BY clause, but with it, I get the aforementioned error.

Any help would be greatly appreciated.

Have a great day,
Ryan

Options: ReplyQuote


Subject
Written By
Posted
invalid use of group by
July 14, 2005 10:13AM
July 14, 2005 10:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.