SUM FUNCTION???

1. Member
Join Date
Dec 1969
Posts
62

## SUM FUNCTION???

I&#039;m new at this... I&#039;m trying to sum up the total QTY of PartID from the tbl_Consume table in descending order by QTY. Please help! Thanks Sendo<BR><BR>&#039;******************************* *****************************<BR>&#039;*********** *************************************************< BR><BR>sqlText = "SELECT SUM (Qty) as TotalQTY" <BR> sqlText = sqlText & "PartID, "<BR> sqlText = sqlText & "Qty, "<BR> sqlText = sqlText & "FROM "<BR> sqlText = sqlText & "tbl_Consume "<BR> sqlText = sqlText & "Where Qty =&#062; 1, DESC"<BR> sqlText = sqlText & "Group by PartID,"<BR><BR>&#039;**************************** ********************************<BR>&#039;******** ************************************************** **

2. Senior Member
Join Date
Dec 1969
Posts
719

## RE: SUM FUNCTION???

Are you getting an error..? If so, what is it..?

3. Senior Member
Join Date
Dec 1969
Posts
2,437

## RE: SUM FUNCTION???

sqlText = "SELECT SUM (Qty) as TotalQTY,"<BR>sqlText = sqlText & "PartID, "<BR>sqlText = sqlText & "FROM "<BR>sqlText = sqlText & "tbl_Consume "<BR>sqlText = sqlText & "Where Qty &#062;= 1 "<BR>sqlText = sqlText & "Group by PartID order by 1 desc"<BR><BR>If you have group by all columns in the select must either be the argument of a set function or present in the group by clause. Thus I removed Qty from the select list. There were also some spurios commas and other minor syntactical issues.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•