select 2, case when wizard_page_id=1 then 'That finished Step 1' when wizard_page_id=2 then 'That finished Step 2' when wizard_page_id=3 then 'That finished Step 3' when wizard_page_id=4 then 'That finished Step 4' end as category ,count(su.user_id) category_count from yp_wizard_survey su, yp_wizard_status st where su.user_id=st.user_id and su.want_style_tags=1 and st.state_id=1 group by wizard_page_id