I have a table called studs with coloumns as :
Sno.    name    grade
1       aa      1
2       bb      1
3       cc      2       
4       dd      3
5       ee      4
6       ff      4
7       gg      4
8       hh      5

Now i want to see only those rows which have value of grade repeated atleast in one other row i.e.
The result should contain row no's 1,2(with grade 1) and 5,6,7(with grade 4)

in two queries this cud be done as :
select sno, count(grade) as cnt from studs group by grade having cnt>1
and then
select * from studs where sno in ('result of previous query')

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to