now() | curdate() | curtime() |
---|---|---|
2011-10-25 15:34:55 | 2011-10-25 | 15:34:55 |
select * from tablename where tablename.datefield <> '' and tablename.timefield <> '' and ( tablename.datefield < curdate() or ( tablename.datefield <= curdate() and tablename.timefield <= curtime() ) ) and tablename.datetime <= now() order by ablename.datefield desc, tablename.timefield asc;