Sql server error using case -


i have here query wrote in visual studio using sql server 2010. extension mdf think i'm using sql server. here structure of table.

occupantid int contacttypeid int contactdetail varchar(255) maincontacttype bit

here sql.

select contactdetail.*, contacttype, firstname + ' ' + lastname occupantname,              case when maincontacttype = 1 'yes' else 'no' maincontacttype             contactdetail              inner join occupant on contactdetail.occupantid=occupant.occupantid              inner join contacttype on contactdetail.contacttypeid=contacttype.contacttypeid 

i'm getting error incorrect syntax near keyword as

the case-expression must end end:

case when maincontacttype = 1 'yes' else 'no' end maincontacttype 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -