I have an events table tbl_events which holds the following information
event_id => int(11)
user_id => int(16)
event_type => tinyint(1)
date_created => int(11)
date_start => int(11)
date_end => int(11)
each of the 3 date fields store a timestamp value
I need to determin whether the listing is active, pending, or expired and then display them in groups so all the active ones first followed by the pending ones and then the expired ones.
Im struggling to work out how to return the status of the listing within my sql query.
i currently have 3 seperate sqls
to get expired listings
to get pending listingsCode:SELECT * FROM `tbl_events` WHERE date_start <= 1392569012 && date_end <= 1392569012
to get active listingsCode:SELECT * FROM `tbl_events` WHERE date_start > 1392569012
but i need to put them into one query.Code:SELECT * FROM `tbl_events` WHERE date_end > 1392569012 && date_start <= 1392569012
What i intend to do is style each of the different statuses differently. so i need each of the listings to return a status value.
any help will be superb!