Integrating three tables

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Dec 9 19:26:00 CST 2005


On 12/9/05 7:09 PM, "jda" <jda at his.com> wrote:

>>     query = "INSERT INTO TableB (refPtr, MoreFieldContents, lablePtr)
>>                 VALUES( 11, 'something', 1 )"
>> 
>>     db.SqlExecute( query )
>> 
>> 
> 
> Hi Ruslan,
> 
> That works, great! Next question: how to I find out if the field
> already exists so I UPDATE instead of INSERT?
 
> Right now I have a cursor with the record from the main table (Table
> A), from which I get the RecID. How to query the table "morefields"
> (Table B) to see if an entry exists that is linked to a record in
> Table A and a LabelPtr in Table C? Is there an API (table)-based way,
> or is SQL better?

SQL or API -- up to your choice.

SQL:

    SELECT recID 
    FROM MoreFields
    WHERE refPtr = 11 AND LablePtr = 1

API:

    if( boFields.RefPtr.Exists(11) AND
        boFields.LablePtr.Exists(1) )
  


-- 
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