Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help in solving query

Author  Topic 

vinod.n.kobal
Starting Member

5 Posts

Posted - 2011-05-05 : 01:33:03
Hello,
I have education table the fields area as follows
edu_id(pk) stud_id(fk) qualification_id(fk) school_name Univ percentage
01 01 01 xyz abc 65
02 01 02 pqr xyz 70
03 01 03 mmm xyz 80
04 02 01 ooo xyz 90
05 03 03 pqr mmm 50

now the problem is i want to find the stud_id those score more than 55%
in his different-different qualification, the result of the query will display only those student who score more than 55% in his acadamic

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-05-05 : 01:46:43
Send How your output look like


In Love... With Me!
Go to Top of Page

vinod.n.kobal
Starting Member

5 Posts

Posted - 2011-05-05 : 01:53:42
quote:
Originally posted by raghuveer125

Send How your output look like


In Love... With Me!



the output will be like display only the stud_id which match the criteria
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2011-05-05 : 02:09:27
SElECT distinct stud_id FROM Education WHERE percentage >= 55

Vaibhav T

If I cant go back, I want to go fast...
Go to Top of Page

vinod.n.kobal
Starting Member

5 Posts

Posted - 2011-05-05 : 02:44:03
i was tried above query
select distinct stud_id from education where percentage >=55
it was work correctly but, in my table there are more no qualification like 10th,12th etc. i want those stud_id who score more than 55% in his overall curriculum
Go to Top of Page

vaibhavktiwari83
Aged Yak Warrior

843 Posts

Posted - 2011-05-05 : 03:08:37
You mean you want the students
who have been persue all the qualification in qualification master
and having percentage more than 55 ?

Is it like this ?

Vaibhav T

If I cant go back, I want to go fast...
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-05-05 : 03:10:20
SELECT stud_id, SUM(percentage)/COUNT(qualification)
GROUP BY stud_id
HAVING SUM(percentage)/COUNT(qualification) > 55

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

vinod.n.kobal
Starting Member

5 Posts

Posted - 2011-05-05 : 03:18:37
quote:
Originally posted by vaibhavktiwari83

You mean you want the students
who have been persue all the qualification in qualification master
and having percentage more than 55 ?

Is it like this ?

Vaibhav T

If I cant go back, I want to go fast...



yes
Go to Top of Page
   

- Advertisement -