Reply to Re: case syntax

Your name:

Reply:


Posted by Dave on 11/05/12 11:16

Dave (dave@REMOVEbundook.com) decided we needed to hear...
> Bob Bedford (bedford1@notforspammershotmail.com) decided we needed to
> hear...
> > Hi,
> >
> > I've no Mysql NG access from my ISP, so let me ask here.
> >
> > I've a case statement in mysql.
> ....
> > I'm trying to do something like:
> >
> > case myvalue
> > when 'X' then valueX
> > when in('Y','A','B') then valueY
> >
> > But I can't get it to work with IN statement. What's the syntax ?
> >
> > Bob
> >
> >
> select case when myvalue = 'X' then valueX
> when myvalue in ('Y','A','B') then valueY else 'something'
>
> If you don't supply the trailing else then null will be returned if
> none of the conditions are satisfied.
>
My apologies - I'm missing an end from the statement...

select case when myvalue = 'X' then valueX
when myvalue in ('Y','A','B') then valueY else 'something' end

--
Dave <dave@REMOVEbundook.com>
(Remove REMOVE for email address)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация