update join

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Fri Mar 2 11:14:38 CST 2012


On 3/2/12 5:58 PM, "George Parkinson" <george at microtherapy.ca> wrote:

> hello all,
> i'm trying to do a mass update of a field in a table with the value of a
> similar field from another table, based on a common id.
> 
> ie:
> UPDATE t1 
> SET t1.f1 = t2.f1 
> FROM t1 
> JOIN t2 ON t1.id = t2.id  
> 
> but this results in an error:
> Kernel error: 0x71000. line 2:7: expecting '=', found '.'


You have see such syntax in some db ?

> i've tried other variations but am obviously missing something (probably
> simple) anyone have a suggestion?

Hi George,

You need do this once for some db
or often ?


==========================
If once, yet exists way with loop

    curs1 = db.SqlSelect( "SELECT T1.RecID1,  .f1  FROM T1 join T2 ... )
      
    for each record
    {
           tbl1.RecID = curs1.ULongField(1).value

           tbl1.UlongField("id").value = curs1.ULongField(2).Value
           tbl1.UpdateRecord()
    }



==========================
IF you have Foreign Key defined on this T1,id = T2.id with name xxxPtr
Then you can use operator ->

But it seems you talk not about normal Foreign Key 1:M
You say about some 1:1  I think ...
And ID - ID ... 



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list