0 down vote favorite
I want list all the upcoming and past events(custom posts) in chronological order. I have saved data by meta key start_time,duration ,
I try to use sql ,but can not get there!
Thanks for any help in advance!
0 down vote favorite
I want list all the upcoming and past events(custom posts) in chronological order. I have saved data by meta key start_time,duration ,
I try to use sql ,but can not get there!
Thanks for any help in advance!
I have tried this,seems not work
SELECT p.* FROM wp_posts AS p, wp_postmeta AS m
WHERE p.ID = m.post_id
ORDER BY ( SELECT ABS(m1.meta_value-UNIX_TIMESTAMP(NOW())) from wp_postmeta AS m1 WHERE m1.meta_key='st_time' AND m1.post_id=p.ID)You must log in to post.