PDA

View Full Version : [SOLVED] Basic SQLite question



lovinglinux
November 25th, 2008, 10:19 AM
I need some help with sqlite3 syntax.

I'm writing a few shell scripts integrated with a sqlite database. I need to get the values from a column and copy to another column in the same entry. Is it possible?

For example:


sqlite3 ~/mydatabase.sqlite "update mytable set column_to_be_updated='????' where filtered_column='${VARIABLE}'"

What I want is to get the "????" value from another column without using a variable.

If this is not possible, how could I retrieve data for each entry row separately? I have multiple entries with the same filtered ${VARIABLE}, so when I replace ???? with another variable, it grabs the column value from all entries.

CptPicard
November 25th, 2008, 01:39 PM
update table set column_to_update=column_to_get_value_from where..

lovinglinux
November 25th, 2008, 03:16 PM
update table set column_to_update=column_to_get_value_from where..



Thank you very much!

I feel kind of stupid tho :mrgreen: