Hi, Mark, Mark Fenbers schrieb: > Wow! I didn't know you could have a (select ...) as a replacement for a > 'from' table/query. Your SQL worked as-is, except I had to add a 'limit > 1' to the first subquery. > > Thanks! I would have never figured that out on my own!
SQL has more power than most think, and PostgreSQL does a good job in implementing most of it. Much more than some other well known "free" databases. Have a look at http://www.postgresql.org/docs/8.1/static/sql-select.html and the other SQL commands at http://www.postgresql.org/docs/8.1/static/sql-commands.html (or your local copy of the manual). HTH, Markus ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match