1

I'm working on some current, and archived SQLite databases.

In current versions, a column is named message, but in the archived versions it's named message_id.

The query I'm running is pretty lengthy/complex, and it's just this one column that's changed. Is there any way I can do some kind of CASE EXISTS style query to do this, or am I just going to have to write a separate query?

1 Answer 1

1

I would suggest writing a view to access the historical data:

create view v_message_history
    select message as message_id, . . . 
    from message_archive;

Then you can use the view and the two columns have the same name.

You could also use alter table to rename the column in either the history or current table. I am guessing, though, that you don't want to do that because it might break existing code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.