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)
 Average Help

Author  Topic 

wylliecoyote
Starting Member

1 Post

Posted - 2006-02-05 : 17:26:09
I need a query that will select only those student IDs with an average amount_paid less than 650. So far I have this written out and it works for returning the data with the criteria given. What would I add to only select where the student_id is less than 650? I have been working on this for hours and can not figure it out.

Thanks.

select student_id as "StudentId", sum(amount_paid) as "Total_Paid",
min(regstrn_made_date) as "Earliest_Reg_Date",
count(*) as "Number_of_courses", avg(amount_paid) as "Average_Paid" from attendance
where offering_id in ('9111','9112','9212')
group by student_id
order by "Total_Paid" desc;

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-02-05 : 17:52:43
...
group by ...
HAVING avg(amount_paid) <650
order by ...
Go to Top of Page
   

- Advertisement -