Select * From (SELECT comment_type post_type, count(*) num FROM wp_comments Where user_id = (2) And comment_type IN ('cma_thread','cma_answer','post','tribe_events') And comment_approved = 1 UNION Select post_type, count(*) num From wp_posts Where post_author In (2) And post_type IN ('cma_thread','cma_answer','post','tribe_events') And post_status = 'publish' Group By post_type UNION Select 'book' post_type, count(*) num From wp_posts Where post_author In (2) And post_type Like '%book' And post_status = 'publish')tblA Order BY post_type;