SQL Query [message #380767] |
Tue, 13 January 2009 04:53 |
manns
Messages: 59 Registered: March 2006 Location: Bangalore
|
Member |
|
|
Hi,
table having student_name, subject and marks columns
max marks - 100
subjects are physics , chemistry , maths
now how to get single seelct stmt in which i get ...student_name , %of total makrks and the third column as PASS or FAIL.
Conditin for pass is that shtdent shud get minimum 50 in each subject
|
|
|
|
|
|
|
|
|
|
|
Re: SQL Query [message #380782 is a reply to message #380780] |
Tue, 13 January 2009 05:52 |
S.Rajaram
Messages: 1027 Registered: October 2006 Location: United Kingdom
|
Senior Member |
|
|
Quote: |
This will not solve this problem since if some one is scoring more then 90% but score less then 50 in 1 subject also should mark as fail.
|
Could you post how you arrived at the conclusion ?
Regards
Raj
|
|
|
Re: SQL Query [message #380797 is a reply to message #380782] |
Tue, 13 January 2009 07:02 |
thangs123
Messages: 1 Registered: January 2008
|
Junior Member |
|
|
Try this,
select student_name,pert,decode(pass,3,'PASS','FAIL') from
(select student_name,sum(marks),round((sum(marks)/300)*100,0) Pert,sum(decode(sign(marks-50),1,1,0,1,-1,0)) pass
from stud1 group by student_name)
|
|
|
Re: SQL Query [message #380798 is a reply to message #380797] |
Tue, 13 January 2009 07:12 |
|
Michel Cadot
Messages: 68704 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
same remark for you:
Michel Cadot wrote on Tue, 13 January 2009 12:26 | Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags.
Use the "Preview Message" button to verify.
Regards
Michel
|
|
|
|