Search Postgresql Archives

question abut "order by" null fields

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I have 2 table

table1:
	id
	column1


table2:
	id
	column2


I perform this query


SELECT column1, column2 FROM table1 LEFT JOIN table2 USING (id)
ORDER BY column1, column2

In the rows where column1 is not null postgres perform ORDER BY column1,
column2

Problem:
In the rows where Column1 is null, postgres don't perform  ORDER BY  on
the column2

Why?

Same behavior when:

SELECT column1, column2 FROM table1 LEFT JOIN table2 USING (id)
ORDER BY coalesce(column1,''), column2


Thanks in advance

-- 
-------------------------------
Alessandro Vincelli




---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux