Lloyd Thomas wrote: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?
Lloyd,
You can't use an UPDATE statement to fill in your new column unless you want all rows to have the same value.
You need to populate your new table using the INSERT ... SELECT ... statement. You use the select statement to combine the data from your old table and your new values using joins to pull values from other tables or calculating the new values based on existing columns.
I hope this helps.
Dennis Cote
Dennis Cote wrote:
- Re: [sqlite] add new column to table Dennis Cote
- Re: [sqlite] add new column to table Lloyd Thomas
- Re: [sqlite] add new column to table Dennis Cote
- Re: [sqlite] add new column to table Lloyd Thomas