View Full Version : query help

03-05-2013, 04:37 AM
iam doing student record project.40 students studying 5 subjects , i want to write sql query to display records of students who scored top 4 marks in each subject.so totaly 20 records to be displayed

03-05-2013, 07:13 AM
What you have done so far?

Old Pedant
03-05-2013, 10:08 PM
And, more importantly, what is your DB design?

If you only have one table, not at least two tables and probably three or more, then it's a bad design that will only be made worse by trying to do this query.

03-08-2013, 10:29 AM
Hi ! i don't give you ans because you didn't explain the fields of your Tables. Can you explain it Clearly?

03-11-2013, 04:48 AM
my database design as follows

student_name subject1_mark subject2_mark subject3_mark subject4_mark subject5_mark

Old Pedant
03-11-2013, 06:27 PM
Bad design. Makes it tough to create a good query.

Your only real choice is 5 separate queries, though you could use a UNION to make it *look* like one query.