Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Sum function

Author  Topic 

lane0618
Posting Yak Master

134 Posts

Posted - 2002-05-17 : 14:55:06
I can't seem to figure out why the following query won't work. It works if I dont use "WHERE (COMPS LIKE '%1086-005%')" in the statement.


SELECT nQty_ship, COMPS
FROM lpp_all
WHERE (COMPS LIKE '%1086-005%')
COMPUTE SUM(nqty_ship)

What do I need to change?

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-17 : 15:31:32
by 'works' I assume you mean why in your front end when you get the recordset, you don't see a sum ... I don't see any reason why this wouldn't compile . . .

answer: if you run this query in qa, it will be very clear to you . . . the sum is in a second recordset, so you neet to use a next recordset or some such thing to see it.

as an aside, based on column names this is a wierd use of compute, can you tell us what data you are asking for from this query?

<O>
Go to Top of Page

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2002-05-19 : 16:44:49
Why not SELECT SUM(nqty_ship), comps FROM lpp_all WHERE 'whatever' GROUP BY COMPS? Will save you the headache of figuring out how to get summary rows in ADO.

Sarah Berger MCSD
Go to Top of Page
   

- Advertisement -