MySQL: Multiple AND queries with using BETWEEN?

fharlankirbyn

New Member
I had seen a colleague use this to fetch users from a table under these conditions:\[code\]SELECT * FROM users WHERE gender ='male' AND activated='yes' AND date_registered BETWEEN '$date1' AND '$date2' \[/code\]He said there was an problem (it not outputting any rows when the \[code\]AND activated='yes'\[/code\] was put there as well, but no MySQL error was thrown.Can you not do this? Do you need to put it in brackets or something crazy to associate the \[code\]BETWEEN\[/code\] and \[code\]AND\[/code\]?Dates are in correct format by the way.
 
Back
Top