Thanks Roger, but it does not work:
 
 SELECT CASE
 when Species_1_e > 0
        THEN 'extern'
 when Species_3_e > 0
        THEN 'intern'
              ELSE ''
          END AS `species_1_l` from species where statsample=1820;
 
 
 ----------Gives at a result 'extern'
 __________________________________________________________________________
 __
 
 SELECT CASE
 
when Species_1_e > 0
        THEN 'extern'
              ELSE ''
          END AS `species_1_l` from species where statsample=1820;
 
 
 ----------Gives at a result 'extern'
 
 
 __________________________________________________________________________
 __and finally,
 
 SELECT CASE
 
 when Species_3_e > 0
        THEN 'intern'
              ELSE ''
          END AS `species_1_l` from species where statsample=1820;
 
 ----------Gives at a result 'intern'
 
 I do not understand, why I can't get extern, intern as a result from this
 selection.
 
 The background is that I have a table with 195 rows and 1000 colums,
 including counting data from species distributions of single samples. 999
 species are the inventar of the whole area, but not all are present in
 each single sample (row). I want to select only columns from single rows,
 containing values > 0, or not NULL.
 Thanks for the help, Jan
 
 
 > -----Ursprüngliche Nachricht-----
> > Von: Roger Baklund [mailto:[EMAIL PROTECTED]
> > Gesendet: Freitag, 18. Februar 2005 13:27
> > An: mysql@lists.mysql.com
> > Cc: Jan Bartholdy
> > Betreff: Re: select case consider the first field only, MySQL 4.18
> >
> > Jan Bartholdy wrote:
> > > Dear List, I have a select case question
> > >
> > > SELECT CASE WHEN `Species_1_l` > 0
> > >              THEN 'intern'
> > >   when 'Species_3_e' > 0
> >
> > 'Species_3_e' is surrounded by single quotes, not backticks... thus it
> > is treated as a string, numeric value is 0, which is never > 0.
> >
> > BTW, there is no version 4.18, you probably meant 4.0.18.
> >
> > --
> > Roger
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> > bartholdy.de
> 
> 
> ____________
> Virus checked by G DATA AntiVirusKit
> Version: AVK 15.0.2975 from 09.02.2005


____________
Virus checked by G DATA AntiVirusKit
Version: AVK 15.0.2975 from 09.02.2005


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to