Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2013
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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
  2. FROM checkins c, volunteers v, nights n
  3. WHERE c.volunteer = v.id
  4. AND c.night = n.id
  5. ORDER BY v.lname ASC, v.fname ASC;
  6.                    
  7.  CheckIn |  Night  | id |    Name     | driver | escort | nav | basecamp | early
  8. ---------+---------+----+-------------+--------+--------+-----+----------+-------
  9.        1 | Night 1 |  1 | System XX A | f      | f      | f   | t        |
  10.        5 | Night 1 |  4 |             | t      | f      | t   | t        | t
  11.        4 | Night 1 |  3 |             | t      | t      | f   | f        |
  12.       10 | Night 1 | 11 | Kit E C     | t      | f      | t   | f        |
  13.        7 | Night 1 |  7 | HERP A D    | f      | t      | f   | t        | t
  14.       11 | Night 1 | 12 | Eat T F     |        |        |     |          |
  15.        9 | Night 1 | 10 | Tom P F     | t      | t      | t   | t        |
  16.        8 | Night 1 |  8 | Kit E K     | t      | t      | t   | t        |
  17.        6 | Night 1 |  6 | Tom P K     | f      | t      | t   | t        |
  18. (9 rows)
  19.  
  20. myke=# \d teams
  21.                                    Table "public.teams"
  22.   Column   |           Type           |                     Modifiers                      
  23. -----------+--------------------------+----------------------------------------------------
  24.  id        | integer                  | not null default nextval('teams_id_seq'::regclass)
  25.  night     | smallint                 | not null
  26.  team      | character varying(32)    | not null
  27.  driver    | integer                  | not null
  28.  escort    | integer                  | not null
  29.  nav       | integer                  | not null
  30.  mt        | boolean                  | not null
  31.  kit       | smallint                 |
  32.  deployed  | timestamp with time zone |
  33.  disbanded | timestamp with time zone |
  34.  notes     | text                     |
  35. Indexes:
  36.     "teams_pkey" PRIMARY KEY, btree (id)
  37. Foreign-key constraints:
  38.     "teams_driver_fkey" FOREIGN KEY (driver) REFERENCES checkins(id)
  39.     "teams_escort_fkey" FOREIGN KEY (escort) REFERENCES checkins(id)
  40.     "teams_kit_fkey" FOREIGN KEY (kit) REFERENCES kits(id)
  41.     "teams_nav_fkey" FOREIGN KEY (nav) REFERENCES checkins(id)
  42.     "teams_night_fkey" FOREIGN KEY (night) REFERENCES nights(id)
  43. Referenced by:
  44.     TABLE "geolog" CONSTRAINT "geolog_team_fkey" FOREIGN KEY (team) REFERENCES teams(id)
  45.     TABLE "trips" CONSTRAINT "trips_team_fkey" FOREIGN KEY (team) REFERENCES teams(id)
  46.  
  47. myke=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement