Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myke=# SELECT c.id AS "CheckIn", n.night AS "Night", v.id, (v.fname || ' ' || v.mname || ' ' || substring(v.lname,1,1)) AS "Name", c.driver, c.escort, c.nav, c.basecamp, c.early
- FROM checkins c, volunteers v, nights n
- WHERE c.volunteer = v.id
- AND c.night = n.id
- ORDER BY v.lname ASC, v.fname ASC;
- CheckIn | Night | id | Name | driver | escort | nav | basecamp | early
- ---------+---------+----+-------------+--------+--------+-----+----------+-------
- 1 | Night 1 | 1 | System XX A | f | f | f | t |
- 5 | Night 1 | 4 | | t | f | t | t | t
- 4 | Night 1 | 3 | | t | t | f | f |
- 10 | Night 1 | 11 | Kit E C | t | f | t | f |
- 7 | Night 1 | 7 | HERP A D | f | t | f | t | t
- 11 | Night 1 | 12 | Eat T F | | | | |
- 9 | Night 1 | 10 | Tom P F | t | t | t | t |
- 8 | Night 1 | 8 | Kit E K | t | t | t | t |
- 6 | Night 1 | 6 | Tom P K | f | t | t | t |
- (9 rows)
- myke=# \d teams
- Table "public.teams"
- Column | Type | Modifiers
- -----------+--------------------------+----------------------------------------------------
- id | integer | not null default nextval('teams_id_seq'::regclass)
- night | smallint | not null
- team | character varying(32) | not null
- driver | integer | not null
- escort | integer | not null
- nav | integer | not null
- mt | boolean | not null
- kit | smallint |
- deployed | timestamp with time zone |
- disbanded | timestamp with time zone |
- notes | text |
- Indexes:
- "teams_pkey" PRIMARY KEY, btree (id)
- Foreign-key constraints:
- "teams_driver_fkey" FOREIGN KEY (driver) REFERENCES checkins(id)
- "teams_escort_fkey" FOREIGN KEY (escort) REFERENCES checkins(id)
- "teams_kit_fkey" FOREIGN KEY (kit) REFERENCES kits(id)
- "teams_nav_fkey" FOREIGN KEY (nav) REFERENCES checkins(id)
- "teams_night_fkey" FOREIGN KEY (night) REFERENCES nights(id)
- Referenced by:
- TABLE "geolog" CONSTRAINT "geolog_team_fkey" FOREIGN KEY (team) REFERENCES teams(id)
- TABLE "trips" CONSTRAINT "trips_team_fkey" FOREIGN KEY (team) REFERENCES teams(id)
- myke=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement