So I am trying to take this:
SELECT 'cran_juniper' AS `set`, c.*
FROM cran_juniper c
WHERE ROW(c.device_fqdn, c.device_ip, c.interface, c.admin_state, c.link_state, c.description) NOT IN
(
SELECT device_fqdn, device_ip, interface, admin_state, link_state, description
FROM cran_juniper_baseline
)
UNION ALL
SELECT 'cran_juniper_baseline' AS `set`, b.*
FROM cran_juniper_baseline b
WHERE ROW(b.device_fqdn, b.device_ip, b.interface, b.admin_state, b.link_state, b.description) NOT IN
(
SELECT device_fqdn, device_ip, interface, admin_state, link_state, description
FROM cran_juniper
)
into outfile 'today.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
;
And insert it into a bash script. Considering there's a SLEW of special characters all over this query, I am having a hard time finding a way to go about this. Any assist would be magical.