-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalisation des indices de repetition BAN - bis ter quater (WIP #223)
- Loading branch information
Showing
2 changed files
with
40 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
WITH | ||
j | ||
AS | ||
(SELECT id, | ||
numero, | ||
nom_voie, | ||
lon, | ||
lat, | ||
rep, | ||
CASE r.numero | ||
WHEN b.numero THEN | ||
CASE | ||
WHEN rep = 'b' THEN 'bis' | ||
WHEN rep = 't' THEN 'ter' | ||
WHEN rep = 'q' THEN 'quater' | ||
ELSE NULL | ||
END | ||
ELSE NULL | ||
END as rep_bis | ||
FROM ban_odbl b | ||
LEFT OUTER JOIN rep_b_as_bis r | ||
USING (id_fantoir,numero) | ||
WHERE code_insee = '__com__') | ||
|
||
SELECT id, | ||
TRIM (BOTH FROM (numero||' '||COALESCE(rep_bis,rep,''))), | ||
nom_voie, | ||
lon, | ||
lat | ||
FROM j; |