22 lines
1.1 KiB
Plaintext
22 lines
1.1 KiB
Plaintext
|
|
SQL SELECT
|
|
s.code,m.code as m_code,s.service_code as service_code,s.svc,s.component,s.unit,
|
|
s.price*(100-s.discount)/100 as discounted_price
|
|
,s.price,s.discount,m.raw_metric,m.metric,s.serviceStart,s.serviceEnd,s.serviceHash,s.serviceCustomName,m.dt,s.free_tier,m.dimension_1,m.dimension_1_name ||'x' as dimension_1_name,m.dimension_2,m.dimension_2_name
|
|
FROM qSpec as s, qUnifiedMetric as m
|
|
WHERE m.wz='62'
|
|
AND s.code=m.code
|
|
AND s.serviceStart <= m.dt
|
|
AND (m.dt <= s.serviceEnd OR s.serviceEnd IS NULL)
|
|
|
|
|
|
UNION ALL
|
|
SELECT NULL, m.code, NULL, NULL, NULL, NULL, 0,
|
|
NULL, NULL, m.raw_metric, m.metric, NULL, NULL, NULL, NULL, m.dt, 0, m.dimension_1, m.dimension_1_name ||'y', m.dimension_2, m.dimension_2_name
|
|
FROM qUnifiedMetric as m where m.code NOT IN ('5','6')
|
|
|
|
UNION ALL
|
|
SELECT s.code, NULL, s.service_code, s.svc, s.component, s.unit, s.price*(100-s.discount)/100 as discounted_price,
|
|
s.price, s.discount, NULL, NULL, s.serviceStart, s.serviceEnd, s.serviceHash, s.serviceCustomName, NULL, 0, NULL, NULL, NULL, NULL
|
|
FROM qSpec as s where s.code NOT IN ('5','6')
|
|
order by m.dt, m.code, dimension_1, dimension_2 |