samedi 31 octobre 2015

How to get multiple value from different condition, Just like WP Meta Query works?

META TABLE ==
meta_id | post_id | meta_key | meta_value
1       | 101     | quantity | 8
2       | 101     | price    | 100
3       | 102     | quantity | 7
4       | 102     | price    | 56
5       | 103     | quantity | 12
6       | 103     | price    | 256


POST TABLE ==
post_id | name      | about
101     | Pencil    | Luxurious pencil only for you
102     | Eraser    | All your mistakes, gone!
103     | Pen       | Unrivaled penmanship, stronger than sword.

How to do a query to post id and get post : name,about with meta: value, price and quantity in a single go?

so the results will be

 101   | Pencil   | Luxurious pencil only for you   | 8   | 100
 102   | Eraser   | All your mistakes, gone!        | 7   | 56
 101   | Pencil   | All your mistakes, gone!        | 12  | 256

Thank you



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire