There is such a task. Pull out the table with a specific sort.
1) By creation date - (there is a date_create field on it I do)
ORDER BY date_create DESC 2) Whether actual announcements are - (there is a field archive , where 0 is actual 1 is not)
3) The dispatch date is not later than today - (there is a discharge_date field that stores the dispatch date)
So, how to get everything in one request, first records 1) Fresh by the date of the announcement, Current ads ( archive=0 ), Date sent overdue, ( NOW()<discharge_date )
Made only on the first point, but it's easy.
SELECT * ,DATE_FORMAT(shipping_date,'%d.%m.%Y') as shipping_date, DATE_FORMAT(discharge_date,'%d.%m.%Y') as discharge_date1 FROM bid_country WHERE id>=0 $string ORDER BY date_create DESC $limit; The variables $string and $limit generated before this. You can ignore them, the main thing is how to sort.