Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quick Embedded statement question 1

Status
Not open for further replies.

relisys

Programmer
Mar 6, 2003
65
GB
I have a table "appointments" in MySQL:

+----+---------+--------+------------+----------+-------+---------+
| id | doctor | sugery | date | time | avail | patient |
+----+---------+--------+------------+----------+-------+---------+
| 1 | DR10001 | 1 | 2003-04-05 | 09:20:00 | 0 | PT15931 |
| 2 | DR10001 | 1 | 2003-04-06 | 10:00:00 | 1 | |
| 3 | DR10001 | 1 | 2003-04-06 | 10:10:00 | 1 | |
| 4 | DR10001 | 1 | 2003-04-08 | 10:10:00 | 0 | PT15000 |
+----+---------+--------+------------+----------+-------+---------+

all i need is to get a count of the number of unique different dates past a given date for an example 2003-04-05

in this case it should give COUNT as 2 for 6th and 8th
could someone please quickly run though the statement.

Many thanks for your help in advance!



 
Try this:
SELECT COUNT(*) FROM appointments WHERE date>'2003-04-06'
 
Try this:
SELECT COUNT(distinct date)
FROM appointments
WHERE date>'2003-04-05'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top