|
18 | 18 | Parking_interim_cycle_hangar_waiting_list |
19 | 19 |
|
20 | 20 | Process the interim cycle hangar waiting list (supplied by Michael W) to add |
21 | | -additional fields (telephone Number, etc). |
| 21 | +additional fields (telephone Number, etc). |
22 | 22 |
|
23 | 23 | 23/12/2024 - Create SQL |
24 | 24 | *********************************************************************************/ |
25 | 25 | With Interim_Wait as ( |
26 | | - SELECT |
27 | | - distinct forename |
28 | | - ,surname |
29 | | - ,email |
30 | | - ,party_id_to |
31 | | - ,party_id |
32 | | - ,cast(uprn as decimal) as uprn |
33 | | - ,address1 |
34 | | - ,address2 |
35 | | - ,post_code |
36 | | - ,x |
37 | | - ,y |
38 | | - ,lat |
| 26 | + SELECT |
| 27 | + distinct forename |
| 28 | + ,surname |
| 29 | + ,email |
| 30 | + ,party_id_to |
| 31 | + ,party_id |
| 32 | + ,cast(uprn as decimal) as uprn |
| 33 | + ,address1 |
| 34 | + ,address2 |
| 35 | + ,post_code |
| 36 | + ,x |
| 37 | + ,y |
| 38 | + ,lat |
39 | 39 | ,long |
40 | | - FROM "parking-raw-zone".interim_cycle_wait_list |
41 | | - WHERE import_date = (select max(import_date) |
| 40 | + FROM "parking-raw-zone".interim_cycle_wait_list |
| 41 | + WHERE import_date = (select max(import_date) |
42 | 42 | from "parking-raw-zone".interim_cycle_wait_list)), |
43 | | - |
| 43 | +
|
44 | 44 | /*** Obtain the llpg data ***/ |
45 | 45 | FULL_LLPG as ( |
46 | 46 | SELECT * From "parking-refined-zone".spatially_enriched_liberator_permit_llpg |
47 | | - WHERE import_date = (select max(import_date) |
| 47 | + WHERE import_date = (select max(import_date) |
48 | 48 | from "parking-refined-zone".spatially_enriched_liberator_permit_llpg) |
49 | 49 | AND address1 not like '%STREET RECORD%'), |
50 | 50 |
|
51 | 51 | STREET_LLPG as ( |
52 | 52 | SELECT * From "parking-refined-zone".spatially_enriched_liberator_permit_llpg |
53 | | - WHERE import_date = (select max(import_date) |
| 53 | + WHERE import_date = (select max(import_date) |
54 | 54 | from "parking-refined-zone".spatially_enriched_liberator_permit_llpg) |
55 | 55 | AND address1 like '%STREET RECORD%'), |
56 | 56 |
|
57 | 57 | /*** Obtain the Party details, where available ***/ |
58 | 58 | Party as ( |
59 | | - SELECT |
| 59 | + SELECT |
60 | 60 | * |
61 | 61 | From "dataplatform-stg-liberator-raw-zone".liberator_licence_party |
62 | 62 | WHERE import_Date = format_datetime(current_date, 'yyyyMMdd')), |
|
65 | 65 | unsubscribed_emails as ( |
66 | 66 | SELECT *, |
67 | 67 | ROW_NUMBER() OVER ( PARTITION BY email_address ORDER BY email_address DESC) row1 |
68 | | - FROM "parking-raw-zone".parking_cycle_hangar_unsubscribed_emails |
69 | | - WHERE import_date = (select max(import_date) |
70 | | - from "parking-raw-zone".parking_cycle_hangar_unsubscribed_emails)) |
71 | | - |
72 | | -SELECT |
| 68 | + FROM "parking-raw-zone".parking_parking_cycle_hangar_unsubscribed_emails |
| 69 | + WHERE import_date = (select max(import_date) |
| 70 | + from "parking-raw-zone".parking_parking_cycle_hangar_unsubscribed_emails)) |
| 71 | +
|
| 72 | +SELECT |
73 | 73 | A.*, cast(D.telephone_number as varchar) as Telephone_Number, C.address2 as Street, B.housing_estate, E.email_address, |
74 | 74 |
|
75 | 75 | format_datetime(CAST(CURRENT_TIMESTAMP AS timestamp), |
|
0 commit comments