I have a sql query and I want to grab all the records in a table by the date. The problem is that the field with the date in it also has a time in it. It is a DATETIME data type.
Anyway ideas?
Matt
You can probably move this to the database section, just thought that I might have to format in PHP first before putting it in the SQL query.
Want to WHERE just the date in a DATETIME data type.
Moderator: General Moderators
It looks like that only works when you SELECT a date. I would like to do:
The ApptDateTime is a DATETIME field.
Code: Select all
$sales_rep = $_GET['sales_rep'];
$todays_date = date('Y-m-d');
$sql = "SELECT * FROM `client_leads` WHERE `SalesRep` = '$sales_rep' and `ApptDateTime` = '$todays_date'";
$result = mysql_query($sql);better solution is to use the date() function mysql.
Code: Select all
SELECT * FROM `my_table` WHERE date(somedate) = '2006-03-05'