Bruno,
> I think you might be able to do this using (one sided) outer joins of the event > table to the Case and Trial Group tables. The join rules will need to work for > exactly one of the two tables. You probably will want to use case statements in > the select list to pick values from the right table. Yeah, I'm doing that in some places. It just doesn't work for all queries. COALESCE() is my friend. -- -Josh Berkus Aglio Database Solutions San Francisco ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html