Re: [SQL] sql can i substitute

2004-12-17 Thread Bruno Wolff III
On Fri, Dec 17, 2004 at 18:22:48 +0530, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On Friday 17 December 2004 06:12 pm, D'Arcy J.M. Cain wrote: > > > An alternative to Andreas' suggestion would be to create a simple lookup > > table and join them. This is good if the real life example can g

Re: [SQL] sql can i substitute

2004-12-17 Thread Bruno Wolff III
On Fri, Dec 17, 2004 at 16:55:45 +0530, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > hi > > table: > > name varchar(10) > fruit integer > > i want to write an sql statement like this: > > select fruit from table > > which should return 'good' if fruit = 1 and 'bad' if fruit =2 and 'rotten'

Re: [despammed] [SQL] sql can i substitute

2004-12-17 Thread Achilleus Mantzios
O Kenneth Gonsalves έγραψε στις Dec 17, 2004 : > On Friday 17 December 2004 05:54 pm, Andreas Kretschmer wrote: > > > Yes, simple: > > > > test=# select name, case > > test-# when fruit = 1 then 'good' > > test-# when fruit = 2 then 'bad' > > test-# when fruit = 3 then 'rotten' end as fruit from

Re: [despammed] [SQL] sql can i substitute

2004-12-17 Thread Kenneth Gonsalves
On Friday 17 December 2004 05:54 pm, Andreas Kretschmer wrote: > Yes, simple: > > test=# select name, case > test-# when fruit = 1 then 'good' > test-# when fruit = 2 then 'bad' > test-# when fruit = 3 then 'rotten' end as fruit from fruit; can one do the same thing for an 'insert' statement? k

Re: [SQL] sql can i substitute

2004-12-17 Thread Kenneth Gonsalves
On Friday 17 December 2004 06:12 pm, D'Arcy J.M. Cain wrote: > An alternative to Andreas' suggestion would be to create a simple lookup > table and join them. This is good if the real life example can get > larger and/or the list can change and you don't want to modify code > every time it does.

Re: [SQL] sql can i substitute

2004-12-17 Thread D'Arcy J.M. Cain
On Fri, 17 Dec 2004 16:55:45 +0530 Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > i want to write an sql statement like this: > > select fruit from table > > which should return 'good' if fruit = 1 and 'bad' if fruit =2 and > 'rotten' if fruit =3 An alternative to Andreas' suggestion would be to

Re: [despammed] [SQL] sql can i substitute

2004-12-17 Thread Andreas Kretschmer
am 17.12.2004, um 17:48:15 +0530 mailte Kenneth Gonsalves folgendes: > > thanks - opened up a whole new world for me. One more thing, the values come > under the column 'case', can i avoid having the column 'case' and get the > 'good', 'bad' and 'rotten' under the column 'fruit'? Yes, simple:

Re: [despammed] [SQL] sql can i substitute

2004-12-17 Thread Kenneth Gonsalves
On Friday 17 December 2004 05:15 pm, Andreas Kretschmer wrote: > test=# select * from fruit; > name | fruit > +--- > Apple | 1 > Banana | 2 > Cherry | 3 > (3 Zeilen) > > > test=# select name, fruit, case > test-# when fruit = 1 then 'good' > test-# when fruit = 2 th

Re: [despammed] [SQL] sql can i substitute

2004-12-17 Thread Andreas Kretschmer
am 17.12.2004, um 16:55:45 +0530 mailte Kenneth Gonsalves folgendes: > hi > > table: > > name varchar(10) > fruit integer > > i want to write an sql statement like this: > > select fruit from table > > which should return 'good' if fruit = 1 and 'bad' if fruit =2 and 'rotten' if > fruit =3 >

[SQL] sql can i substitute

2004-12-17 Thread Kenneth Gonsalves
hi table: name varchar(10) fruit integer i want to write an sql statement like this: select fruit from table which should return 'good' if fruit = 1 and 'bad' if fruit =2 and 'rotten' if fruit =3 can it be done? kg ---(end of broadcast)--- TI