mysql - How do i write this query -


here problem

using case expression, display author’s first name concatenated last name separated space concatenated “ is: “. concatenate previous result slogan based on value in state column. if state “ca” display “sunny”. if state “co”, display “a rarity”. if state “fl”, display “a peach”. if state “ny”, display “likes apple pie”. name column “author characteristics”. order result “author characteristics”.

here code have written far

select concat(au_fname, au_lname, ' is: '), case state     when 'ca'         'sunny'     when 'co'         'a rarity'     when 'fl'         'a peach'     when 'ny'         'like apple pie'     else 'state' end "author characteristics" authors order 1; 

the problem having output giving me 2 columns, 1 titled concat statement , second column titled author characteristics. need 1 field information 1 title.

just make case argument concat.

select concat(au_first, au_last, ' is: ', case state when 'ca' 'sunny' when 'co' 'a rarity' when 'fl' 'a peach' when 'ny' 'like apple pie' else 'state' end) "author characteristics" 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -