php - MySQL Query, Date Range From "Blacklist" -


I have 2 databases are a attribute and second is dates . In the date I mean the land_ID and a date (in YYYYMMDD format), which means that the date is not available .

I need to prepare a query that the user can specify the start and end dates, and then select the property for which the dates are available ( date Not in the database) How do the airlines and hotel websites have such arguments? I was thinking about taking the date range and taking all the days in between and doing a query where the dates did not match the number of results and gave it the order, but I can see that it is easily done in a deep query How can change

('id' int (11) faucet auacrement, `land_id` nit (11) null,` date` varchar (255) null, primary key (`id`)) engine = mesam default charces = latin1 AUTO_INCREMENT = 44; - `` `` `` `` `` `` ```` `` `` `,` 40, 1 , '20100523'), (41, 1, '20100521'), (42, 1, '20100525');

Having the form of VARCHAR made it difficult Ask a question I suggest saving the date as DATE and using the following query. It should help:

  Date from SELECT * where '& lt; Start_date & gt; And '& lt; End_date & gt;  

It does not select dates between the given ranges

  SELECT STR_TO_DATE (date, '% Y%)  < / P>   m% d ') as the actual date where the actual_data is not' & lt; Start_date & gt; 'And' & lt; End_date & gt; Select  

or

  to date (date) from date of actual date as to where real_ date not '& lt; Start_date & gt; And '& lt; End_date & gt;  

BTW: & lt; Start_date & gt; and & lt; End_date & gt; Placeholders are there to insert solid dates (YYYY-MM-DD in format).


Comments