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?



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





Reply via email to