Igor Tandetnik wrote:
> 
> viking2 <[EMAIL PROTECTED]> wrote:
>> I have a database (*.db3) with 3 tables:
>>
>> CREATE TABLE TB_Signature (Filename TEXT, FileSignature TEXT, FileSize
>> INTEGER, FileDate INTEGER, PRIMARY KEY (FileSignature,FileSize));
>>
>> CREATE TABLE TB_FileRecords (pszFilename TEXT PRIMARY KEY, nFileSize
>> INTEGER, nFileSignature TEXT);
>>
>> CREATE TABLE TB_SignatureRecords (nFileSignature TEXT PRIMARY KEY,
>> nFileDate INTEGER );
>>
>> I want to merge the bottom two tables, TB_SignatureRecords &
>> TB_FileRecords, into the top one, TB_Signature so that:
>>
>>   from TB_SignatureRecords:
>> nFileSignature goes to 2nd column in TB_Signature
>> nFileDate goes to 4th column in TB_Signature
>>
>>   from TB_FileRecords:
>> pszFilename goes to 1st column in TB_Signature
>> nFileSize goes to 3rd column in TB_Signature
> 
> insert into TB_Signature(Filename, FileSignature, FileSize, FileDate)
> select fr.pszFilename, fr.nFileSignature, fr.nFileSize, sr.nFileDate
> from TB_FileRecords fr join TB_SignatureRecords sr
>     on (fr.nFileSignature = sr.nFileSignature)
> 
> Igor Tandetnik 
> 
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
> 
> 
> 

Thank you Igor!

It worked on my simple test database, although I don't exactly undersatand
the command you wrote...  Now it appears that my database is somehow
corrupted and I would like to try it in steps.  Could you please tell me the
command for merging one of the tables only (Rather than both at the same
time)?

I will first copy TB_SignatureRecords using the following command:
insert into TB_Signature select "",nFileSignature,0,nFileDate from
TB_SignatureRecords; 

What I need help with is the command for merging the second table:
    from TB_FileRecords:
pszFilename replaces 1st column in TB_Signature
nFileSize replaces 3rd column in TB_Signature

Thanks again!
Viking
-- 
View this message in context: 
http://www.nabble.com/Novice-Question-about-SQLite-Insert-Command-tf2572155.html#a7181033
Sent from the SQLite mailing list archive at Nabble.com.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to