Re: IF() problem

2004-11-17 Thread Jon Stephens
A clarification. If a string value begins with a digit, MySQL does not convert it to zero (FALSE), but rather to an integer made up of the leading digits in the value (until a non-digit is reached). This can be shown by using the CAST() function. mysql> SELECT '21b' = 0, CAST('21b' AS SIGNED);

Re: IF() problem

2004-11-17 Thread Przemyslaw Popielarski
Jon Stephens <[EMAIL PROTECTED]> wrote: > *Any* string value evaluates as 0 (FALSE), not just the empty string. Right. Didn't know that. > You want "If BOOK1PL is not empty, return BOOK1PL, otherwise return > BOOK1EN", correct? > > Then try this instead: > > SELECT IF(BOOK1PL <> '', BOOK1PL, B

Re: IF() problem

2004-11-17 Thread Jon Stephens
Date: Wed, 17 Nov 2004 12:50:47 +0100 To: [EMAIL PROTECTED] From: "Przemyslaw Popielarski" <[EMAIL PROTECTED]> Subject: IF() problem Message-ID: <[EMAIL PROTECTED]> select IF(BOOK1PL,BOOK1PL,BOOK1EN) from tBooksextra where ksi='id' -> (content of BOOK1EN) select BOOK1PL from tBooksextra WHERE BOOK