I have to insert some data in my table of existing client_id column , so i am using select with insert
INSERT into 'my_table' (column1, client_id, column3) VALUES (val1,select distinct client_id from 'my_table', val3)
I need client_id from the same table my_table and i need client_ids in insert statement.
SELECT DISTINCT client_id FROM my_table gives me 113 client_id so i want to insert some row for each 113 client using the above approach.
I did this query
INSERT INTO client_notification_preferences (client_id, object_type , frequency,created_at,updated_at) SELECT DISTINCT client_id, 'ClientShipment',1, CURRENT_TIMESTAMP , CURRENT_TIMESTAMP FROM client_notification_preferences;
create_table "client_notification_preferences", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
t.uuid "client_id"
t.string "object_type"
t.integer "frequency"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

client_notification_preferences.