create temporary table foo as select patientnumber, count(*) as rcount
from source_table
group by patientnumber
having count(*) > 1;

select count(*) from foo;

-----Original Message-----
From: Jon Rosenberg [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 1:29 PM
To: [EMAIL PROTECTED]
Subject: select query question


I have a table where patient visits are logged each visit, the table is:

patientnumber,visitdate,location

I need to select and count the number of records that have 2 or more entries
with the same patientnumber

in sql-english:
select count(*) where there are two or more records with the same
patientnumber

Any help with the SQL to do this would be much appreciated.  Thanks!

Jon


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to