If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Count ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-04, 08:11
Neba Neba is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
Count ?

Hi, below tells me all of the students who have failed an exam

select emark, surname, forenames from result, student
where emark=0
and result.netid = student.netid;

im looking for the person who has failed six exams
ive tried:

select emark, surname, forenames from result, student
where emark=0
(select count( surname) where surname >6)
and result.netid = student.netid;

but no luck. Iv'e also tried distinct surname as well.
Can someone point me in the right direction.

Thanx
Reply With Quote
  #2 (permalink)  
Old 02-25-04, 08:22
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Count ?

select student.netid, count(*)
from result, student
where emark=0
and result.netid = student.netid
group by student.netid
having count(*) >= 6;
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 02-25-04, 08:28
Neba Neba is offline
Registered User
 
Join Date: Feb 2004
Posts: 4
that does the trick,
thanx alot.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On