Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Max and Min score
Message
 
 
To
06/04/2007 06:29:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01212837
Message ID:
01212918
Views:
11
>
>select * from tests t1 ;
>	where ;
>	score = (select min(score) from tests t2 where t1.student = t2.student) ;
>	or ;
>	score = (select max(score) from tests t2 where t1.student = t2.student)
>
>* Not in older versions
>select t1.* from tests t1 ;
>	INNER join ;
>	(select student, max(score) as maxScore, min(score) as minScore ;
>	from tests group by 1) t2 ;
>	on t1.student = t2.student and (t1.score = t2.maxScore or t1.score = t2.minScore)
>
Cetin,

The last one is nice, but should you also group by testname in both cases?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform