On Thu, Jan 13, 2011 at 01:44:12PM -0600, Josh Marell scratched on the wall:

> Schedule {
> date TEXT UNIQUE NOT NULL
> problem_set INTEGER
> literature INTEGER
> research INTEGER}
> 
> Presenters {
> p_id INTEGER PRIMARY KEY
> short_name TEXT UNIQUE NOT NULL}

> I am trying to create a view such that the output is the 4 columns in the
> schedule table, except instead of the p_id being displayed, I want to
> replace those values with the short_name.
> 
> For any given date, 2 of the 3 categories is set to a p_id and the 3rd is
> null.


CREATE VIEW Schedule_names AS
  SELECT s.date, p.name, l.name, r.name
    FROM      Schedule   AS s
    LEFT JOIN Presenters AS p ON ( s.problem_set = p.p_id )
    LEFT JOIN Presenters AS l ON ( s.literature  = l.p_id )
    LEFT JOIN Presenters AS r ON ( s.research    = r.p_id );



   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to