pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
new calculated column
4+ messages / 3 participants
[nested] [flat]

* new calculated column
@ 2002-09-05 16:53  andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
  0 siblings, 1 reply; 4+ messages in thread

From: andres javier garcia garcia @ 2002-09-05 16:53 UTC (permalink / raw)
  To: pgsql-sql

Hi;

I've got a table with two fields and about 3000 rows, the second one is a 
character field, what can have about twenty different values; of course these 
values are repeated a lot of times in the table. I need to create a new 
column of type integer, whose value depens on the character fields. The 
values of the new column are not important, the important thing is who can I 
create this column and assign a different integer to a different char value 
in the other column.
Thanks
--------------
Javier



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* new calculated column
@ 2002-09-05 16:58  andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
  0 siblings, 1 reply; 4+ messages in thread

From: andres javier garcia garcia @ 2002-09-05 16:58 UTC (permalink / raw)
  To: pgsql-sql

Hi;

I've got a table with two fields and about 3000 rows, the second one is a
character field, what can have about twenty different values; of course these
values are repeated a lot of times in the table. I need to create a new
column of type integer, whose value depens on the character fields. The
values of the new column are not important, the important thing is who can I
create this column and assign a different integer to a different char value
in the other column.
Thanks
--------------
Javier

-------------------------------------------------------



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: new calculated column
@ 2002-09-05 18:49  mallah@trade-india.com
  parent: andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
  0 siblings, 0 replies; 4+ messages in thread

From: mallah@trade-india.com @ 2002-09-05 18:49 UTC (permalink / raw)
  To: andresjavier.garcia@wanadoo.es; +Cc: pgsql-sql


HI.


simple (tedious) solution would be do fire 20 sqls.


update tabel set f1=<some int 1> where f2='some varchar1';
update tabel set f1=<some int 2> where f2='some varchar2';
update tabel set f1=<some int 3> where f2='some varchar3';

incase there is some the integer is a function of varchar
u may translate to the corresponding SQL.


regds
mallah.





> Hi;
>
> I've got a table with two fields and about 3000 rows, the second one is a character field, what
> can have about twenty different values; of course these values are repeated a lot of times in
> the table. I need to create a new column of type integer, whose value depens on the character
> fields. The values of the new column are not important, the important thing is who can I create
> this column and assign a different integer to a different char value in the other column.
> Thanks
> --------------
> Javier
>
> -------------------------------------------------------
>
> ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9'
> the postmaster



-----------------------------------------
Get your free web based email at trade-india.com.
   "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: new calculated column
@ 2002-09-09 14:01  Viacheslav N Tararin <taras@dekasoft.com.ua>
  parent: andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
  0 siblings, 0 replies; 4+ messages in thread

From: Viacheslav N Tararin @ 2002-09-09 14:01 UTC (permalink / raw)
  To: andres javier garcia garcia <andresjavier.garcia@wanadoo.es>; pgsql-sql

For implicit modification you can use a trigger on the table. If you 
wan't store this data, you can use view.

andres javier garcia garcia ?????:

>Hi;
>
>I've got a table with two fields and about 3000 rows, the second one is a 
>character field, what can have about twenty different values; of course these 
>values are repeated a lot of times in the table. I need to create a new 
>column of type integer, whose value depens on the character fields. The 
>values of the new column are not important, the important thing is who can I 
>create this column and assign a different integer to a different char value 
>in the other column.
>Thanks
>--------------
>Javier
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly
>
>
>  
>






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-09-09 14:01 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-05 16:53 new calculated column andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
2002-09-09 14:01 ` Viacheslav N Tararin <taras@dekasoft.com.ua>
2002-09-05 16:58 new calculated column andres javier garcia garcia <andresjavier.garcia@wanadoo.es>
2002-09-05 18:49 ` mallah@trade-india.com

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox