Skip to main content

Posts

Showing posts from October, 2020

how to use CASE,WHEN and ELSE statesman in mysql

 make sure are created other wise create your table and add some data. for example :   then run this query: SELECT first_name, last_name,  ( CASE             WHEN user_id < 3 THEN "Admin user"            WHEN user_id = 3 THEN "editor user"            ELSE  "suscriber user"  END) as role  FROM users;   the result output is : you can define query as per your requirement.