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)
 Adding Max and Count

Author  Topic 

Cynthia Blue
Starting Member

1 Post

Posted - 2006-08-22 : 16:54:49
This query is close to what I want but not quite... can anyone help me out just a bit?

My problem is... I want ALL the ( doc_actg_ln_no ) fields added to only the ( disc_ln_am fields > 0 ). This adds only the Ln_no fields which correspond to the disc_ln_am fields > 0.

quote:
select count(disc_ln_am) + max(doc_actg_ln_no) as Total, chk_no, doc_id, curr_sys_dt
from ad_doc_actg
where and (ad_doc_actg.disc_ln_am > 0)
group by chk_no, doc_id, curr_sys_dt
having (count(disc_ln_am) + max(doc_actg_ln_no)) > 10


Thanks.

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2006-08-23 : 07:45:54
Cynthia - I think you better supply the table structure, some sample data, and the desired output...


Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-08-23 : 08:03:12
Read and post accordingly ..

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Chirag
Go to Top of Page
   

- Advertisement -