query takes a long time

Started by Garry Saddingtonover 17 years ago2 messagesgeneral
Jump to latest
#1Garry Saddington
garry@schoolteachers.co.uk

Can someone suggest how I could speed up the execution of this query?

select count(distinct attendance.studentid)
from attendance
where attendance.studentid not in (select studentid from attendance where auth not in('C','E','F','G','H','I','M','N','O','R','S','T','U'))

It returns the correct results but very slowly.
regards
garry

#2marcin mank
marcin.mank@gmail.com
In reply to: Garry Saddington (#1)
Re: query takes a long time

select count(distinct attendance.studentid)

from attendance

where attendance.studentid not in (select studentid from attendance where
auth not in('C','E','F','G','H','I','M','N','O','R','S','T','U'))

I am tired a lot now, but isn`t it the same as:

select count(distinct attendance.studentid)

from attendance

where auth in('C','E','F','G','H','I','M','N','O','R','S','T','U')

?