0

Hello I have a PostgreSQL 9.1 database with such tables [tables are simplified]

enter image description here

For now I use only tables: account, account_word and word. But I wanted to add groups of words into my database. So I created tables wordgroup and wordgroup_word. Now my table account_word is no longer needed so I would like to move all words from account_word to wordgroup_word. In general:

I would like to move all account's word to his wordgroup where group's "is_all" is true and then delete account_word table

Could someone help me to achieve this?

Cheers

1
  • Grodek: you can follow something as specified here Commented Nov 5, 2012 at 9:21

1 Answer 1

1

move all words from account_word to wordgroup_word.

 insert into wordgroup_word 
    select  wordgroup_id, word_id
    from account_word aw join wordgroup wg 
    on aw.account_id = wg.account_id 
    and is_all=true
Sign up to request clarification or add additional context in comments.

1 Comment

I will try your solution soon.

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.