Update api.moorages_view

This commit is contained in:
xbgmsharp
2023-09-13 21:58:51 +02:00
parent 7b11de9d0d
commit ecb6e666d2

View File

@@ -193,8 +193,8 @@ CREATE OR REPLACE VIEW api.moorages_view WITH (security_invoker=true,security_ba
-- justify_hours ( m.stay_duration ) -- justify_hours ( m.stay_duration )
FROM api.moorages m, api.stays_at sa FROM api.moorages m, api.stays_at sa
WHERE m.name is not null WHERE m.name is not null
AND m.stay_code = sa.stay_code
AND geog IS NOT NULL AND geog IS NOT NULL
AND m.stay_code = sa.stay_code
GROUP BY m.id,m.name,sa.description,m.stay_duration,m.reference_count,m.geog,sa.stay_code GROUP BY m.id,m.name,sa.description,m.stay_duration,m.reference_count,m.geog,sa.stay_code
-- ORDER BY 4 DESC; -- ORDER BY 4 DESC;
ORDER BY m.reference_count DESC; ORDER BY m.reference_count DESC;
@@ -208,14 +208,16 @@ CREATE OR REPLACE VIEW api.moorage_view WITH (security_invoker=true,security_bar
SELECT id, SELECT id,
m.name AS Name, m.name AS Name,
m.stay_code AS Default_Stay, m.stay_code AS Default_Stay,
sa.stay_code AS Default_Stay_Id,
m.home_flag AS Home, m.home_flag AS Home,
EXTRACT(DAY FROM justify_hours ( m.stay_duration )) AS Total_Stay, EXTRACT(DAY FROM justify_hours ( m.stay_duration )) AS Total_Stay,
m.reference_count AS Arrivals_Departures, m.reference_count AS Arrivals_Departures,
m.notes m.notes
-- m.geog -- m.geog
FROM api.moorages m FROM api.moorages m, api.stays_at sa
WHERE m.name IS NOT NULL WHERE m.name is not null
AND geog IS NOT NULL; AND geog IS NOT NULL
AND m.stay_code = sa.stay_code;
-- Description -- Description
COMMENT ON VIEW COMMENT ON VIEW
api.moorage_view api.moorage_view