Oliver, > SELECT DISTINCT ON (two.two_id) two.two_value FROM one,two WHERE > (one.two_id=two.two_id > AND one.updatenr > two.updatenr) ORDER BY two.updatenr ASC;
FWIW, SELECT DISTINCT ON () is slower than SELECT .... ORDER BY ... LIMIT 1 on all stable versions of Postgres. Not that the LIMIT 1 method can be used with all queries. -- -Josh Berkus Aglio Database Solutions San Francisco ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly