Programming Blog

This blog is about technical and programming questions and there solutions. I also cover programs that were asked in various interviews, it will help you to crack the coding round of various interviews

Monday 17 September 2018

Case statement MySQL

                Case  statement in MYSQL


Syntax-

Select CASE WHEN(condition) THEN 'Statement'
                      WHEN(condition) THEN 'Statement'
                       ELSE 'Statement'
                       END


Example-

Select Name, CASE WHEN(a.application_status=3) THEN 'Assigned' WHEN(a.application_status=4) THEN 'Submitted' WHEN(a.application_status=8) THEN 'Report Accepted'  ELSE 'NA' END as 'Application Status',
From Application a



No comments:

Post a Comment