User Tools
Writing /app/www/public/data/meta/toolsandtechnologies/mysql_code_snippets.meta failed
toolsandtechnologies:mysql_code_snippets
Differences
This shows you the differences between two versions of the page.
| toolsandtechnologies:mysql_code_snippets [2019/06/05 13:14] – created mmcc | toolsandtechnologies:mysql_code_snippets [2021/06/25 10:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== mySQL Code Snippets ====== | ||
| + | ===== Copy contact responsibilities from one contact to another ===== | ||
| + | |||
| + | '' | ||
| + | (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 ===== | ||
| + | |||
| + | '' | ||
| + | (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]);'' | ||