Subject | Re: [firebird-support] update from select |
---|---|
Author | niegil.thomas@topsyssolutions.com |
Post date | 2007-08-20T11:59:28Z |
Hi Sasha,
I feel better than updating , Do Multiple selects in a query and delete the existing record from the table and append this query to the table i feel this will be faster . Please be carefull to uses all key fields properly.
Eg
Delete from Testtable ;( cond if any);
Select TestID , (Select Testname From TestNameMaster where Testnamemater.ID=TestMaster.TestIID) As Name,
(Select Testname From TestNameMaster where Testnamemater.ID=TestMaster.TestIID) As Type,
(Select TestDuration From TestDurationMaster where TestDurationmater.ID=TestMaster.TestIID) As Duration,
(Select TestStartDate From TestStartDate where TestStartDate.ID=TestMaster.TestIID) As StartDate,
.........
From TestMaster
I found such a move to faster . Hope this Eg meets ur requirement .
Good Luck
Niegil Thomas
I feel better than updating , Do Multiple selects in a query and delete the existing record from the table and append this query to the table i feel this will be faster . Please be carefull to uses all key fields properly.
Eg
Delete from Testtable ;( cond if any);
Select TestID , (Select Testname From TestNameMaster where Testnamemater.ID=TestMaster.TestIID) As Name,
(Select Testname From TestNameMaster where Testnamemater.ID=TestMaster.TestIID) As Type,
(Select TestDuration From TestDurationMaster where TestDurationmater.ID=TestMaster.TestIID) As Duration,
(Select TestStartDate From TestStartDate where TestStartDate.ID=TestMaster.TestIID) As StartDate,
.........
From TestMaster
I found such a move to faster . Hope this Eg meets ur requirement .
Good Luck
Niegil Thomas
----- Original Message -----
From: sasha
To: firebird-support@yahoogroups.com
Sent: Monday, 20 August, 2007 4:51 PM
Subject: RE: [firebird-support] update from select
>
> I must be Monday morning stupids but I cannot remember/find
> the syntax to update one table from another when there are
> multiple fields involved.
>
> I got "update table1 set field1 = (select field2 from table2
> where ...)" but I have about 12 fields involved.
>
> Could someone more awake please post an example or pointer to
> one, thanks
>
update table1 set
field1 = (select fileld2 from table2 where...),
field2 = (select field3 from table2 where...),
...
where table1...
Mondays can be awful :)
Sasha
[Non-text portions of this message have been removed]