I have a Postgres database with 3 tables, say A
, B
and C
. I want to select data from table A
and loop through each row checking the value in one of the columns and then insert the data into table B
or table C
based on the condition.
How can I do this, can some one please post a sample script please. I prefer plpgsql (using PGAdmin3).