从日期中选择(字符串格式)[关闭]

Inside my Mysql database I have records like this :

-----------------------------------
id    |    datePost
-----------------------------------
1     |     24/01/2015,13/02/2016,29/12/2016

And width my query I have this date 28/01/2016

I have to search if query date is between datePost ( if 28/02/206 is between datePost values)

I think I have explode the datePost then foreach the result array to do the comparison? The problem is that I have many records inside table and it may results slow search.

What do you think ? What is the best method ?

Instead of foreaching your query which will be pretty slow, try using a select statement that uses wildcards

$date = "28/01/2016"
$qry_dates = mysql_query("SELECT * FROM dates_table WHERE datePost LIKE '%$date%'");

I haven't tested this, but maybe it'll be faster than using PHP to query them all.

EDIT You didn't mention anything about PHP, so the full sql select would be this:

SELECT * FROM date_table WHERE datePost LIKE '%28/01/2016%'