coparing dates? SQL
| From: | Amanda McComb | Date: | Wed, 21 May 2003 23:57:58 +0000 |
| Subject: | coparing dates? SQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-148476@lists.php.net to get a copy of this message | ||
How do you compare dates in SQL? I have two drop down lists with dates
for start date and end date. I want to see how many customers have a
field between those two dates. Here is what I had, but it doesn't return
anything.
SELECT count(*) FROM customer_t WHERE date_entered >= $start_date and
date_entered <= $end_date ORDER BY date_entered
Also, I want to compare $start_date and $end_date before I run this query
to make sure $start_date is before $end_date. How can I compare them in
PHP?
Thanks,
Amanda