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)
 Distinct By Date With AVG

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-12-13 : 00:10:22
Jason writes "I want to return the last test score insted of the Max(t.score) is there any way to do this, It would be returned associated with
max(t.test_date).

I only want to get 1 record for each l.test_link_id to userid.

select distinct l.test_link_id,
avg(distinct t.score)* 100 as Average_Score,
l.test_link_name,
max(t.test_date) as Test_Date,
Max(t.score) * 100 as Last_Score, count(*) as Times_Taken
from test_scores t, test_link l
where user_kdev_user_id='userid'
and t.test_date=t.test_date
and t.test_link_test_link_id=l.test_link_id
group by l.test_link_name, l.test_link_id
order by t.test_date desc


Thank you for your help."
   

- Advertisement -