EDIT

The only working example I can see is the following.
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE t1_backup(a,b);
INSERT INTO t1_backup SELECT a,b FROM t1;
DROP TABLE t1;
CREATE TABLE t1(a,b);
INSERT INTO t1 SELECT a,b FROM t1_backup;
DROP TABLE t1_backup;
COMMIT;
I can not find any help or FAQ regarding UPDATES with SUB SELECTS. What is
the URL?
Lloyd

----- Original Message -----
From: "Bert Verhees" <[EMAIL PROTECTED]>
To: <sqlite-users@sqlite.org>
Sent: Tuesday, January 11, 2005 7:55 AM
Subject: Re: [sqlite] add new column to table


Op maandag 10 januari 2005 23:56, schreef Lloyd Thomas:
Thanks. That is going OK but I am having a problem with updating the new
column with the info I need. It seems to update with the same entry from my
users table to all rows.


UPDATE call_data SET caller_name = (SELECT firstname || surname AS
'caller_name' FROM users WHERE extn_no = (SELECT extn_no FROM call_data));


I have missed something?

The FAQ gives a working example, I used it a lot, please try that.

Bert Verhees




----- Original Message ----- From: "Lloyd Thomas" <[EMAIL PROTECTED]> To: <sqlite-users@sqlite.org> Sent: Monday, January 10, 2005 9:08 PM Subject: Re: [sqlite] add new column to table

> Thanks Paul,
> I have used that example before to recreate a table. > Can I
> use the same thing to recreate a table and populate a new column with
> data from a select query.
> The table I wish to recreate has an ID number in it and I wish to use
> this to get the forename and surname from another table.
>
> Lloyd
> ----- Original Message -----
> From: "Paul Dixon" <[EMAIL PROTECTED]>
> To: <sqlite-users@sqlite.org>
> Sent: Monday, January 10, 2005 5:50 PM
> Subject: Re: [sqlite] add new column to table
>
>> Lloyd Thomas wrote:
>>>I wish to create a new column in a table and add data, which is >>>queried
>>>from another table.What is the best way?
>>
>> There's no "ALTER TABLE" support in the support language, so you have >> to
>> recreate the entire table and re-populate it.
>>
>> Check the FAQ: http://www.sqlite.org/faq.html#q13
>>
>> Paul

-- Met vriendelijke groet Bert Verhees ROSA Software




Reply via email to