Changeset 968 for trunk/jpdd/sql/db.sql
- Timestamp:
- Jan 30, 2008 3:48:56 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/jpdd/sql/db.sql (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/jpdd/sql/db.sql
r951 r968 958 958 959 959 960 CREATE OR REPLACE VIEW person_categories AS SELECT person_id, 960 CREATE OR REPLACE VIEW person_categories AS SELECT person_id, event_id, 961 961 COUNT(category_id = 9 OR NULL) > 0 AS math, 962 962 COUNT(category_id = 15 OR NULL) > 0 AS art, … … 964 964 COUNT(category_id = 12 OR NULL) > 0 AS history, 965 965 COUNT(category_id = 25 OR NULL) > 0 AS english 966 FROM person_event_category GROUP BY person_id; 967 966 FROM person_event_category GROUP BY person_id, event_id; 967 968 CREATE OR REPLACE VIEW pommo_person_categories AS SELECT person_id, event_id, 969 CASE WHEN math THEN '"on"' ELSE '' END AS math, 970 CASE WHEN art THEN '"on"' ELSE '' END AS art, 971 CASE WHEN science THEN '"on"' ELSE '' END AS science, 972 CASE WHEN history THEN '"on"' ELSE '' END AS history, 973 CASE WHEN english THEN '"on"' ELSE '' END AS english 974 FROM person_categories; 968 975 969 976 -- we're redoing the pommo import with our new conception of what data … … 973 980 974 981 CREATE OR REPLACE VIEW pommo_import AS SELECT first_name, middle_name, 975 last_name, email, person_categories.*, organization.title AS 982 last_name, email, person_event.person_id, 983 pommo_person_categories.math, 984 pommo_person_categories.art, 985 pommo_person_categories.science, 986 pommo_person_categories.history, 987 pommo_person_categories.english, 988 organization.title AS 976 989 school, event_id FROM 977 990 978 person JOIN p erson_categories ON (person.id = person_id) JOIN (SELECT991 person JOIN pommo_person_categories ON (person.id = person_id) JOIN (SELECT 979 992 DISTINCT person_id, event_id FROM person_event_category) AS 980 person_event USING (person_id ) LEFT JOIN affiliation ON (person.id =993 person_event USING (person_id, event_id) LEFT JOIN affiliation ON (person.id = 981 994 affiliation.person_id) LEFT JOIN organization ON (organization_id = 982 organization.id) ORDER BY l ast_name,first_name;995 organization.id) ORDER BY lower(last_name),lower(first_name); 983 996 984 997 -- -- here's the actual export: … … 991 1004 -- jpdd=> 992 1005 993 -- and then i needed to swap out ,"on", and ,, for ,t, and ,f,994 995 1006 -- e-mail addresses will be treated case-insensitively: this is 996 1007 -- against the RFC, but it is a minor inconvenience for a tiny subset
Note: See TracChangeset
for help on using the changeset viewer.

