my result is this
testId studentId marks result title name
1 96 5 Passed Test Your IQ? Paul
1 96 6 Passed Test Your IQ? Paul
1 78 0 Failed Test Your IQ? Mark
1 96 1 Failed Test Your IQ? Paul
How can i change the RS to:
how many times each student appeared 4 each test
eg Paul takes Test Your IQ? 3 times mark 1 time
pls help
php query
Moderator: General Moderators
Far too little information.
Are you using mysql , pgsql, flat file?
By 'appeared 4 each test' i presume you mean 'appeared for each test'?
By 'RS' do you mean 'result' ?
Do you have some existing code you can show us ?
What have you tried so far ?
Did you read http://www.catb.org/~esr/faqs/smart-que ... html#intro
Not trying to be anal or anything, but a more detailed initial question usually saves a load of posts trying to get to the actual problem/solution
Are you using mysql , pgsql, flat file?
By 'appeared 4 each test' i presume you mean 'appeared for each test'?
By 'RS' do you mean 'result' ?
Do you have some existing code you can show us ?
What have you tried so far ?
Did you read http://www.catb.org/~esr/faqs/smart-que ... html#intro
Not trying to be anal or anything, but a more detailed initial question usually saves a load of posts trying to get to the actual problem/solution
thanks mark for pointing to my too little info
ifound out that by using GROUP BY and COUNT we can still manipulate the initial resultset to get to the desired result
$sql="SELECT count(r.testId), r.studentId, t.title, u.name FROM qb_test_report as r, qb_test as t, user as u
WHERE r.status='Completed' AND t.testId=r.testId AND u.id=r.studentId
GROUP BY r.testId, r.studentId";
****************Thanx MAte***************
ifound out that by using GROUP BY and COUNT we can still manipulate the initial resultset to get to the desired result
$sql="SELECT count(r.testId), r.studentId, t.title, u.name FROM qb_test_report as r, qb_test as t, user as u
WHERE r.status='Completed' AND t.testId=r.testId AND u.id=r.studentId
GROUP BY r.testId, r.studentId";
****************Thanx MAte***************