api.moorages_stays_view
Description
Moorages stay listing web view
Table Definition
CREATE VIEW moorages_stays_view AS (
SELECT _to.name AS _to_name,
_to.id AS _to_id,
_to._to_time,
_from.id AS _from_id,
_from.name AS _from_name,
_from._from_time,
s.stay_code,
s.duration,
m.id,
m.name
FROM api.stays_at sa,
api.moorages m,
((api.stays s
LEFT JOIN api.logbook _from ON ((_from._from_time = s.departed)))
LEFT JOIN api.logbook _to ON ((_to._to_time = s.arrived)))
WHERE ((s.departed IS NOT NULL) AND (s.name IS NOT NULL) AND (s.stay_code = sa.stay_code) AND (s.moorage_id = m.id))
ORDER BY _to._to_time DESC
)
Columns
| Name | Type | Default | Nullable |
|---|---|---|---|
| _from_id | integer | true | |
| _from_name | text | true | |
| _from_time | timestamp with time zone | true | |
| _to_id | integer | true | |
| _to_name | text | true | |
| _to_time | timestamp with time zone | true | |
| duration | interval | true | |
| id | integer | true | |
| name | text | true | |
| stay_code | integer | true |
Referenced Tables
| Name | Columns | Comment | Type |
|---|---|---|---|
| api.stays_at | 2 | Stay Type | BASE TABLE |
| api.logbook | 42 | Stores generated logbook | BASE TABLE |
Relations
erDiagram
"api.moorages_stays_view" {
integer _from_id ""
text _from_name ""
timestamp_with_time_zone _from_time ""
integer _to_id ""
text _to_name ""
timestamp_with_time_zone _to_time ""
interval duration ""
integer id ""
text name ""
integer stay_code ""
}
Generated by tbls