Recordsetclown
Technical User
Hi,
I want to insert one row per each value of listingsdb_id into a table with the following fields:
field_name, field_value, listingsdbelements_id, listingsdb_id, user_id
There are an unknown and variable number of rows already in this table for each unique listingsdb_id. I've tried the following, but am at a loss as to how to limit the number of inserted rows to one per unique listingsdb_id.
INSERT
INTO default_en_listingsdbelements
(listingsdbelements_field_name,listingsdbelements_field_value,listingsdb_id,userdb_id)
SELECT 'listingagentofficephone','123-456-7890',r2.listingsdb_id,1
FROM default_en_listingsdbelements AS r1
INNER
JOIN default_en_listingsdb AS r2
ON r2.listingsdb_id = r1.listingsdb_id
r2 has one listingsdb_id per row, but this seems to insert a row into r1 for each row already in r1. Thanks for any help.
I want to insert one row per each value of listingsdb_id into a table with the following fields:
field_name, field_value, listingsdbelements_id, listingsdb_id, user_id
There are an unknown and variable number of rows already in this table for each unique listingsdb_id. I've tried the following, but am at a loss as to how to limit the number of inserted rows to one per unique listingsdb_id.
INSERT
INTO default_en_listingsdbelements
(listingsdbelements_field_name,listingsdbelements_field_value,listingsdb_id,userdb_id)
SELECT 'listingagentofficephone','123-456-7890',r2.listingsdb_id,1
FROM default_en_listingsdbelements AS r1
INNER
JOIN default_en_listingsdb AS r2
ON r2.listingsdb_id = r1.listingsdb_id
r2 has one listingsdb_id per row, but this seems to insert a row into r1 for each row already in r1. Thanks for any help.