Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-05-2013, 03:37 AM   PM User | #1
arun.xavier50
New Coder

 
Join Date: May 2011
Posts: 18
Thanks: 6
Thanked 0 Times in 0 Posts
arun.xavier50 is an unknown quantity at this point
query help

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
arun.xavier50 is offline   Reply With Quote
Old 03-05-2013, 06:13 AM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,689
Thanks: 158
Thanked 2,184 Times in 2,171 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
What you have done so far?
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 03-05-2013, 09:08 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,569
Thanks: 62
Thanked 4,060 Times in 4,029 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Old 03-08-2013, 09:29 AM   PM User | #4
JefferyJamison
New Coder

 
Join Date: Sep 2012
Location: USA
Posts: 13
Thanks: 0
Thanked 2 Times in 2 Posts
JefferyJamison is an unknown quantity at this point
Hi ! i don't give you ans because you didn't explain the fields of your Tables. Can you explain it Clearly?
JefferyJamison is offline   Reply With Quote
Users who have thanked JefferyJamison for this post:
arun.xavier50 (03-11-2013)
Old 03-11-2013, 03:48 AM   PM User | #5
arun.xavier50
New Coder

 
Join Date: May 2011
Posts: 18
Thanks: 6
Thanked 0 Times in 0 Posts
arun.xavier50 is an unknown quantity at this point
data base design

my database design as follows

student_name subject1_mark subject2_mark subject3_mark subject4_mark subject5_mark
arun.xavier50 is offline   Reply With Quote
Old 03-11-2013, 05:27 PM   PM User | #6
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,569
Thanks: 62
Thanked 4,060 Times in 4,029 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:15 AM.


Advertisement
Log in to turn off these ads.