User Tools
Table of Contents
mySQL Code Snippets
Copy contact responsibilities from one contact to another
INSERT INTO contact_responsibility (version, element_id, rank, responsibility_type, contact_id)
(SELECT
0 AS version,
cr.element_id AS element_id,
cr.rank AS rank,
cr.responsibility_type AS responsibility_type,
[id of contact that is being copied TO] AS contact_id
FROM
contact_responsibility cr JOIN
contact co ON co.id = cr.contact_id
WHERE
co.id = [id of contact that is being copied FROM]);
Copy contact responsibilities from one element to another
INSERT INTO contact_responsibility (version, element_id, rank, responsibility_type, contact_id)
(SELECT 0 AS version,
[id of element that is being copied TO] AS element_id,
cr.rank AS rank, cr.responsibility_type AS responsibility_type,
cr.contact_id AS contact_id
FROM contact_responsibility cr JOIN network_element ne ON ne.id = cr.element_id
WHERE ne.id = [id of element that is being copied FROM]);