datoshway Posted November 26, 2010 Share Posted November 26, 2010 This is my select statement. SELECT * FROM tblEvents WHERE boolApproved = 1 ORDER BY dtEventDate ASC I am looking for this to only select events that are current, so anything that has expired from the current timestamp I would like it to not display. Any ideas on how to do this? Link to comment https://forums.phpfreaks.com/topic/219870-select-statement-within-current-date-range/ Share on other sites More sharing options...
Pikachu2000 Posted November 26, 2010 Share Posted November 26, 2010 What do you mean by expired, events that have a value in `dtEventDate` that is in the past? Link to comment https://forums.phpfreaks.com/topic/219870-select-statement-within-current-date-range/#findComment-1139743 Share on other sites More sharing options...
datoshway Posted November 26, 2010 Author Share Posted November 26, 2010 Correct. dtEventDate has the timestamp assigned to it. SO if it's past I would like it to just not select. Link to comment https://forums.phpfreaks.com/topic/219870-select-statement-within-current-date-range/#findComment-1139745 Share on other sites More sharing options...
Pikachu2000 Posted November 26, 2010 Share Posted November 26, 2010 Assuming dtEventDate is a DATETIME data type, try this. SELECT * FROM tblEvents WHERE boolApproved = 1 AND dtEventDate >= NOW() ORDER BY dtEventDate ASC Link to comment https://forums.phpfreaks.com/topic/219870-select-statement-within-current-date-range/#findComment-1139750 Share on other sites More sharing options...
datoshway Posted November 26, 2010 Author Share Posted November 26, 2010 You rock man, thank you so much, works like a charm. Assuming dtEventDate is a DATETIME data type, try this. SELECT * FROM tblEvents WHERE boolApproved = 1 AND dtEventDate >= NOW() ORDER BY dtEventDate ASC Link to comment https://forums.phpfreaks.com/topic/219870-select-statement-within-current-date-range/#findComment-1139751 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.