1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| With Depot (id_depot, lb_depot) as
(
select 1, 'Super Depot' from dual union all
select 2, 'Mega Depot' from dual union all
select 3, 'Giga Depot' from dual
)
, Magasin (id_magasin, lb_magasin, id_depot) as
(
select 1, 'Grand Magasin', 1 from dual union all
select 2, 'Petit Magasin', 2 from dual union all
select 3, 'Grand Magasin', 3 from dual
)
select m.id_magasin
, substr(d.lb_depot, 1, 3) || '-' || m.lb_magasin as lb_magasin
, m.id_depot
from Magasin m
join Depot d ON d.id_depot = m.id_depot;
ID_MAGASIN LB_MAGASIN ID_DEPOT
---------- ----------------- --------
1 Sup-Grand Magasin 1
2 Meg-Petit Magasin 2
3 Gig-Grand Magasin 3 |
Partager