Quote:
Originally Posted by Publisher Bucks
This is what I'm using which, from what I have seen online, should be working:
"SELECT * FROM CookingShows WHERE Date BETWEEN '2022-01-09' AND Date '2022-01-10' ORDER BY Date DESC;");
Multiple sites are saying that is the correct format, yet it isnt displaying any data that I have in the table.
Any thoughts?
|
1. You have the syntax wrong. The correct syntax is "where date between date1 and date2" not "where date between date1 and
date date2".
2. You are trying to compare a string to a date. You need to cast the strings as dates if you want a date compare. "where date between cast(date1 as date) and cast(date2 as date)"
3. Date is a keyword in MYSQL and should not be used as a variable name or field name. So where you have your column called date ("where Date...") should be something like "where order_date...." Or whatever other name the date is stored as.
.