On Wednesday 31 March 2004 18:50, John Liu wrote:
> I know this is an old topic, but it's not easy to find a way around it, so
> when we migrate SQL from other database to PostgreSQL, it causes a huge
> headache. Here's an extremely simple example -
>
> The original simple SQL -
> select distinct atcode from TMP order by torder;
Can you explain what this means? If I have
atcode | torder
AAA | 20
BBB | 5
CCC | 10
BBB | 45
CCC | 27
What order should we get?
You could argue for:
1. BBB,CCC,AAA since that is the order of the min(torder)
2. AAA,CCC,BBB since that is the order of the max(torder)
3. AAA,BBB,CCC if you take the first(torder) you find reading down the page
4. AAA,CCC,BBB if you take the first(torder) but read up the page
Which one should PG pick, and how should it know?
Which one did the other database pick, and why was it right to do so?
--
Richard Huxton
Archonet Ltd