I’m using PHP and SQL to create a stats summary based on weekly periods.
I initially thought all the items would have the same date and the code below worked in that situation.
$result1 = mysql_query("SELECT * FROM phoneappdetail WHERE salebarn = 'OSI' AND saledate = '2012-06-6' ORDER BY wtcode ");
However now I’ve found out that the items I need to query have varying days.
How can I change my query to get dates between 2012-06-6 and 2012-06-12 instead of only dates exactly on 2012-06-6?
Use SQL BETWEEN clause: