mysql

Uncategorized

How to write subquery to get the same fields from undetermined tables dynamically

SELECT SUM(t.orgBilledDuration/60) AS Duration FROM (SELECT orgBilledDuration FROM Successfuliptsp.vbSuccessfulCDR_631 WHERE FROM_UNIXTIME(connectTime/1000, ‘%Y-%m-%d %H:%i:%s’) BETWEEN ‘2021-10-20 00:00:00’ AND ‘2021-12-05 23:59:59’ UNION ALL SELECT orgBilledDuration FROM Successfuliptsp.vbSuccessfulCDR_632 WHERE FROM_UNIXTIME(connectTime/1000, ‘%Y-%m-%d %H:%i:%s’) BETWEEN ‘2021-10-20 00:00:00’ AND ‘2021-12-05 23:59:59’ UNION ALL SELECT orgBilledDuration FROM Successfuliptsp.vbSuccessfulCDR_633 WHERE FROM_UNIXTIME(connectTime/1000, ‘%Y-%m-%d %H:%i:%s’) BETWEEN ‘2021-10-20 00:00:00’ AND ‘2021-12-05 23:59:59’ ) t From the […]

Read More