Posted by Steve on 02/23/06 23:32
> Thanks for this answer. I guess my question is a little more general.
> Let's say the month isn't hard-coded, but I am guaranteed to have it in
> the form
>
> $monthVar = "YYYY-MM-DD HH:MI:SS.0";
>
> How would I write a MySQL query that searches between the first and
> last days of the month represented by the above?
Ah, a different question with a different answer. Using PHP & MySQL:
$sql = "SELECT * FROM trips WHERE MONTH( startdate ) = MONTH(
\"$monthVar\" ) AND YEAR( startdate ) = YEAR( \"$monthVar\" )";
---
Steve
[Back to original message]
|