(Wordpress) Converting wp_metapost data as column

CREATE OR REPLACE view test as (
 select
   wp_postmeta.post_id,
   case when meta_key = "<YOUR_KEY>" then meta_value end as columnName1,
    case when meta_key = "<ANOTHER_KEY>" then meta_value end as columnName2
 from wp_postmeta
   where meta_value not like ''
);



Example:
CREATE OR REPLACE view test as (
 select
   wp_postmeta.post_id,
   case when meta_key = "old_page_url" then meta_value end as url,
    case when meta_key = "meta_description" then meta_value end as meta_description
 from wp_postmeta
   where meta_value not like ''
);


This will create a new view with two columns.
Post a Comment

Popular posts from this blog

[Solved] Hive installation error: java.net.URISyntaxException: Relative path in absolute URI

Install Android SDK in centOs

Installing arules package (Association Rules) in R