Am Montag, den 25.07.2005, 18:11 -0300 schrieb Marc G. Fournier: > Just curious as to whether or not a warning or something should be issued > in a case like: > > SELECT c.* > FROM company c, company_summary cs > WHERE c.id = cs.id > AND cs.detail = 'test' > ORDER BY cs.fullname; > > Unless I'm missing something, the ORDER BY clause has no effect, but an > EXPLAIN shows it does take extra time, obviously ...
It just does the sorting as you requested. Check the order of the resulting c.id. See: experiment=# SELECT * FROM A; a_id | a_value ------+--------- 1 | abc 2 | bcd 3 | def (3 rows) experiment=# SELECT * FROM B; b_id | b_value ------+--------- 1 | xyz 2 | ijk 3 | abc (3 rows) experiment=# SELECT a.* FROM a,b WHERE a.a_id=b.b_id ORDER BY b_value; a_id | a_value ------+--------- 3 | def 2 | bcd 1 | abc (3 rows) So no reason for warnings :-) ---------------------------(end of broadcast)--------------------------- TIP 1: 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