custom MYSQL select query in WORDPRESS -
i'm creating wordpress site. have sql table (wp_postmeta) additional informations: dates , times home , away mathes. (plugin acf). table row this:
meta_id post_id meta_key meta_value 1 123 home_0_date 20130512 2 123 home_1_date 20130513 3 123 home_0_time 13h 4 123 home_1_time 16h 5 123 away_0_date 20130514 6 123 away_1_date 20130515 7 123 away _0_time 18h 8 123 away _1_time 19h
there corrispondence betweet home_n_date , home_n_time , between away_n_date , away_n_time. in fact in case i'm adding 2 home matches: 12 / 05 / 2013 13h , 13 / 05 / 2013 16h , 2 away matches 14/ 05 / 2013 18h , 15/ 05 / 2013 19h .
for custom calendar i've custom mysql query:
select * wp_postmeta pmd join wp_posts ps on ps.id = pmd.post_id (pmd.meta_key 'away_%_date' || pmd.meta_key 'home_%_date') && ps.post_status = 'publish';
this works fine in case i'm selecting dates without time no distinction between home , away matches. want add times , way differentiate home , away matches (adding variables?)
"select * wp_postmeta pmd join wp_posts ps on ps.id = pmd.post_id left join wp_postmeta pmt on ps.id = pmt.post_id (pmd.meta_key 'away_%_date' || pmd.meta_key 'home_%_date') && (pmt.meta_key 'away_%_time' || pmt.meta_key 'home_%_time') && (% = % /*???*/) && ps.post_status = 'publish';
any idea?
Comments
Post a Comment