Why do I get these results????? - Mailing list pgsql-sql

From Joost Kraaijeveld
Subject Why do I get these results?????
Date
Msg-id 1141375840.4267.16.camel@localhost
Whole thread Raw
Responses Re: Why do I get these results?????
List pgsql-sql
Hi,

Why do I get the following result from the query below? I expected that,
given the fact that there are over 100 "Jansen" (but no "jansen") in
"Nijmegen" the first record would definitively be people living in
"Nijmegen". If I change the order to the order that is commented out,
the query goes OK.

SELECT 
addresses.zipcode, 
addresses.city, 
addresses.housenumber,
addresses.housenumberdetails, 
customers.lastname 
FROM prototype.customers JOIN prototype.addresses ON
customers.contactaddress = addresses.objectid
WHERE
TRIM(UPPER(customers.lastname)) >= TRIM(UPPER('Jansen'))
AND
TRIM(UPPER(addresses.city)) >= TRIM(UPPER('NIJMEGEN'))
ORDER BY customers.lastname, addresses.city, addresses.zipcode
--ORDER BY addresses.city, customers.lastname, addresses.zipcode
limit 5

Result:

"3089TN";"ROTTERDAM";"5";"";"jansen"
"5712XG";"SOMEREN";"13";"";"jansen"
"6511PS";"NIJMEGEN";"23";"";"Jansen"
"6523RE";"NIJMEGEN";"13";"";"Jansen"
"6524NP";"NIJMEGEN";"37";"A";"Jansen"

TIA

-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: J.Kraaijeveld@Askesis.nl
web: www.askesis.nl



pgsql-sql by date:

Previous
From: "Gregory S. Williamson"
Date:
Subject: Re: Sequential scan where Index scan expected (update)
Next
From: Joost Kraaijeveld
Date:
Subject: Re: Why do I get these results?????