Re: if else statement

2006-06-25 Thread Thomas Lundström
fre 2006-06-23 klockan 01:52 -0400 skrev Michael Stassen: > Thomas Lundström wrote: > > Not sure what you're aming for here and how your data is structured but > > why not use a join and alias and fetch all info in one select and then > > solve what you need in your code? > > > > Something in

Re: if else statement

2006-06-22 Thread Michael Stassen
Song Ken Vern-E11804 wrote: > Hi, > > I'm trying to build a query in using SQL instead of doing it in Perl. > > I am trying to do something like this : > > If ((select col1 from table1 where id = 1) == 3) > Then > Select col2 from table2 where table2.id = 1; > Else > Select col2 from table3 where

RE: if else statement

2006-06-22 Thread Song Ken Vern-E11804
is. Examples only show numeric and string functions. -Original Message- From: Peter Lauri [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 21, 2006 4:43 PM To: [EMAIL PROTECTED]; Song Ken Vern-E11804 Cc: mysql@lists.mysql.com Subject: RE: if else statement SELECT IF(col1=3, (Select col2 f

RE: if else statement

2006-06-21 Thread Peter Lauri
Cc: mysql@lists.mysql.com Subject: Re: if else statement Not sure what you're aming for here and how your data is structured but why not use a join and alias and fetch all info in one select and then solve what you need in your code? Something in the line of: select t2.col2 from_t2, t3

Re: if else statement

2006-06-21 Thread Thomas Lundström
Not sure what you're aming for here and how your data is structured but why not use a join and alias and fetch all info in one select and then solve what you need in your code? Something in the line of: select t2.col2 from_t2, t3.col2 from_t3 from table1 t1, table2 t2, table3 t3 where t1.id = t

Re: if else statement

2006-06-21 Thread Jørn Dahl-Stamnes
On Wednesday 21 June 2006 11:16, Song Ken Vern-E11804 wrote: > Hi, > > I'm trying to build a query in using SQL instead of doing it in Perl. > > I am trying to do something like this : > > If ((select col1 from table1 where id = 1) == 3) > Then > Select col2 from table2 where table2.id = 1; > Else

if else statement

2006-06-21 Thread Song Ken Vern-E11804
Hi, I'm trying to build a query in using SQL instead of doing it in Perl. I am trying to do something like this : If ((select col1 from table1 where id = 1) == 3) Then Select col2 from table2 where table2.id = 1; Else Select col2 from table3 where table3.id = 1; In Perl I would probably do

Re: If Else statement

2004-01-27 Thread Mike Tuller
rver 10.2, so if the suggestion you gave me is the only way (or the best) I will have to upgrade the server. If there is another way to do the same thing, please let me know. Mike > From: Egor Egorov <[EMAIL PROTECTED]> > Date: Mon, 26 Jan 2004 15:40:54 +0200 > To: [EMAIL PROTE

Re: If Else statement

2004-01-26 Thread Egor Egorov
Mike Tuller <[EMAIL PROTECTED]> wrote: > I am trying write a shell script to check to see if a record exists and if > it does, update information, and if it doesn't insert information. Is there > a way to do an if else statement in MySql? > If you have PRIMARY KEY or UNIQU

If Else statement

2004-01-23 Thread Mike Tuller
I am trying write a shell script to check to see if a record exists and if it does, update information, and if it doesn't insert information. Is there a way to do an if else statement in MySql? I'm stuck on how to do this. I don't want to write it in perl. Mike -- MySQL Gener

Re: Help - select syntax if else

2003-01-08 Thread Keith C. Ivey
On 8 Jan 2003, at 15:27, Svens Klave wrote: > | image | check | > | 6782 | 0 | > | 2732 | 1 | > | 6734 | 1 | > > so I want to make query > select * from foo1 where [so is it possible to make some if check=1 then > image is image but if check=0 then into image goes othe

Re: Help - select syntax if else

2003-01-08 Thread Zak Greant
On Wed, Jan 08, 2003 at 03:27:51PM +0200, Svens Klave wrote: > > Can anybody help me > with select query > > how to do this: > > I have table "foo1" with two fields "image" "check" > > | image | check | > | 6782 | 0 | > | 2732 | 1 | > | 6734 | 1 | > > so I want to ma

Re: Help - select syntax if else

2003-01-08 Thread Roger Baklund
* Svens Klave > Can anybody help me > with select query I can try. > how to do this: > > I have table "foo1" with two fields "image" "check" > > | image | check | > | 6782 | 0 | > | 2732 | 1 | > | 6734 | 1 | > > so I want to make query > select * from foo1 where [so is

Re: Help - select syntax if else

2003-01-08 Thread Brent Baisley
You don't even need the "check" field you can just directly check the contents of the image field. Although I'm not sure if you are trying to set a filter or display something different. If you want to display a conditional on a field then you need to specify that field directly. select *,if(im

Help - select syntax if else

2003-01-08 Thread Svens Klave
Can anybody help me with select query how to do this: I have table "foo1" with two fields "image" "check" | image | check | | 6782 | 0 | | 2732 | 1 | | 6734 | 1 | so I want to make query select * from foo1 where [so is it possible to make some if check=1 then image

if ... else ...

2001-01-25 Thread Chakravarthy K Sannedhi
Hi all, I am having 5 rows in a mysql database related to five different users. these rows contains their firstname, lastname and details of scenes 1 to 5(these details are numeric values from 1 to 3). if any of these fields from scenes 1 to 5 are empty that will be detected from the firstname of