Update Command in SQL Gupta 6.1 SP10

comp.databases.gupta (1995-2015)
Rajan

Update Command in SQL Gupta 6.1 SP10

Post by Rajan » 13 Feb 2002, 03:53

 Posted by:  cra...@yahoo.com (Rajan) 

Hi all,

Thanks to all who have responded to my previous request.

I am doing a multi-table update statement. In Sybase or SQL Server, I
will do the multi-table update something like this:

update table1
set table1.field1 = table2.field1,
table1.field2 = table2.field2,
table1.field3 = table2.field3
from table1, table2
where table1.pkey = table2.pkey

In SQL Gupta, if I try to perform the above operation, it is not
allowing me to specify the "from" clause in the Update Statement.

Can somebody help me to rewrite the above update statement in SQL
Gupta to make it work?

Thanks in advance,

Rajan C

??????? ????????

Update Command in SQL Gupta 6.1 SP10

Post by ??????? ???????? » 13 Feb 2002, 09:43

 Posted by:  ??????? ???????? <vo...@zalk.com.ua> 

Update table1
set
table1.field1 = (select table2.field1 from table2
where table1.pkey = table2.pkey),
table1.field2 = (select table2.field2 from table2
where Table1.pkey = table2.pkey),
table1.field3 = (select table2.field3 from table2
where table1.pkey = table2.pkey);


Something like this...

Peter Popp

Update Command in SQL Gupta 6.1 SP10

Post by Peter Popp » 13 Feb 2002, 11:16

 Posted by:  peter...@msc-software.de (Peter Popp) 

Am Wed, 13 Feb 2002 10:43:40 +0200 schrieb <vo...@zalk.com.ua>


I am not sure about sqlbase 6x, but (imho) in 5x update with
subselects does not work.

greetings
Peter Popp
email: Peter...@msc-software.de

Luc SIMON

Update Command in SQL Gupta 6.1 SP10

Post by Luc SIMON » 13 Feb 2002, 19:44

 Posted by:  luc....@skynet.be (Luc SIMON) 

cra...@yahoo.com (Rajan) wrote:


You have to do a select to generate your updates:

select 'update table 1 set field1 = ' || table2.field1 || ', field2 =
''' || table2.field2 || ''', ... where rowid = ''' || table1.rowid ||
'''; '
from table1, table2
where table1.pkey = table2.pkey;


Execute the result of this select to update the table 1.


A+

Luc.
/-------------------
! Luc SIMON !
! Namur !
! Belgium !
-------------------/

Return to “comp.databases.gupta”

Who is online

Users browsing this forum: [Ccbot] and 0 guests