Yes, I have got the tip from 'Carl Troein', thanks anyway

CASE value WHEN [compare-value] THEN result [WHEN [compare-value] THEN result ...] 
[ELSE result] END 

Best regards
Joacim 

> -----Original Message-----
> From: Harald Fuchs [mailto:[EMAIL PROTECTED]]
> Sent: den 27 augusti 2001 11:43
> To: [EMAIL PROTECTED]
> Subject: Re: Search and compare
> 
> 
> In article 
> <[EMAIL PROTECTED]>,
> Jarkeborn Joacim <[EMAIL PROTECTED]> writes:
> 
> > Hi,
> > Oracle has a fuction that compares value and then returns 
> another value.
> > DECODE( expr, search, result [, search, result] ... [, default] )
> 
> > E.g.
> 
> > DECODE (deptno, 10, 'ACCOUNTING', 
> >                 20, 'RESEARCH', 
> >                 30, 'SALES', 
> >                 40, 'OPERATION', 
> >                     'NONE')
> 
> > If 'deptno' is equal to 10 the string 'ACCOUNTING' is 
> returned, 20 => 'RESEARCH'....etc. If no match 'NONE' will be 
> returned.
> 
> > Is there some similar function in mySQL?
> 
> Yes.  You can use CASE or IF() for that.
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
> <mysql-unsubscribe-joacim.jarkeborn=consultant.volvo.com@lists
> .mysql.com>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to