471,073 Members | 1,279 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

Query question

Hi, I have the following query:

select sls2.shpr, sum(sls2.pkgs) as pkgs, sum(sls2.amnt) as sales,
nams.code, nams.name, sls1.numb, sls2.numb, sls1.prnt
from sls1, sls2, nams
where sls2.shpr=nams.code and sls1.numb=sls2.numb and sls1.prnt=2
group by sls2.shpr
order by sales desc

This gives me a ranking of our suppliers. I want to modify it though.

There is another field (char(4)) in the sls2 table called comm. If the
first character in this field is a 'W', I want to exclude that record from
the sum of sls2.amnt. And if it's an 'L' I want to exclude that record
from the sum of sls2.pkgs

I'm using MySQL 4.1.
Can anyone provide a clue? Thanks.
Jul 20 '05 #1
0 1107

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

22 posts views Thread by Stan | last post: by
3 posts views Thread by Richard Hollenbeck | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.