Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- sélectionne les CPT type "commune" pour en exporter l'ID, le titre, et les métas "cp", "lat", lng" et "shapes"
- SELECT p.ID,
- p.post_title,
- MAX(CASE WHEN pm.meta_key='cp' THEN pm.meta_value ELSE NULL END) AS 'cp',
- MAX(CASE WHEN pm.meta_key='lat' THEN pm.meta_value ELSE NULL END) AS 'lat',
- MAX(CASE WHEN pm.meta_key='lng' THEN pm.meta_value ELSE NULL END) AS 'lng',
- MAX(CASE WHEN pm.meta_key='shapes' THEN pm.meta_value ELSE NULL END) AS 'shapes'
- FROM vtx_posts p LEFT JOIN vtx_postmeta pm ON (pm.post_id=p.ID)
- WHERE p.post_type='commune' AND p.post_title!='Brouillon auto'
- GROUP BY p.ID
- ORDER BY p.ID ASC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement