1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| SELECT SUM(Employees), SUM(Clients), SUM(Abonnes), SUM(Trains), SUM(Gares), SUM(Reservations), SUM(Billets)
INTO v_nbempl, v_nbcli, v_nbabo, v_nbtrain, v_nbgares, v_nbresa, v_nbbillet
FROM
(SELECT COUNT(*) AS Employees, 0 AS Clients, 0 AS Abonnes, 0 AS Trains, 0 AS Gares, 0 AS Reservations, 0 AS Billets FROM t_employees
UNION ALL
SELECT 0, COUNT(*), 0, 0, 0, 0, 0 FROM t_clients
UNION ALL
SELECT 0, 0, COUNT(*), 0, 0, 0, 0 FROM t_clients
WHERE MONTHS_BETWEEN(date_abonnement, SYSDATE) <=12
UNION ALL
SELECT 0, 0, 0, COUNT(*), 0, 0, 0 FROM t_trains
UNION ALL
SELECT 0, 0, 0, 0, COUNT(*), 0, 0 FROM t_gares
UNION ALL
SELECT 0, 0, 0, 0, 0, COUNT(*), 0 FROM t_reservations
UNION ALL
SELECT 0, 0, 0, 0, 0, 0, COUNT(*) FROM t_billets
) |
Partager