mirror of https://github.com/sipwise/db-schema.git
Change-Id: I8eca46d113dc6d3c52f254eb80db5ad0ae25db9cchanges/34/18834/2
parent
86d928abd9
commit
237e2371f2
@ -0,0 +1,12 @@
|
|||||||
|
set sql_log_bin=0;
|
||||||
|
USE billing;
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW v_contract_timezone AS
|
||||||
|
SELECT cc.id as contact_id, c.id as contract_id,
|
||||||
|
COALESCE(cc.timezone, rc.timezone, t.name) as name
|
||||||
|
FROM contracts c
|
||||||
|
JOIN contacts cc ON cc.id = c.contact_id
|
||||||
|
JOIN resellers r ON r.id = cc.reseller_id
|
||||||
|
JOIN contracts i ON i.id = r.contract_id
|
||||||
|
JOIN contacts rc ON rc.id = i.contact_id
|
||||||
|
JOIN ngcp.timezone t;
|
@ -0,0 +1,14 @@
|
|||||||
|
set sql_log_bin=0;
|
||||||
|
USE billing;
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW v_contract_timezone AS
|
||||||
|
SELECT cc.id as contact_id, c.id as contract_id,
|
||||||
|
COALESCE(cc.timezone, rc.timezone, t.name) as name
|
||||||
|
FROM contracts c
|
||||||
|
JOIN contacts cc ON cc.id = c.contact_id
|
||||||
|
LEFT JOIN resellers r ON r.id = cc.reseller_id
|
||||||
|
LEFT JOIN contracts i ON i.id = r.contract_id
|
||||||
|
LEFT JOIN contacts rc ON rc.id = i.contact_id
|
||||||
|
JOIN ngcp.timezone t;
|
||||||
|
|
||||||
|
|
Loading…
Reference in new issue