Why do I get these results?????

Поиск
Список
Период
Сортировка
От Joost Kraaijeveld
Тема Why do I get these results?????
Дата
Msg-id 1141375840.4267.16.camel@localhost
обсуждение исходный текст
Ответы Re: Why do I get these results?????  (Ragnar <gnari@hive.is>)
Список 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 по дате отправления:

Предыдущее
От: "Gregory S. Williamson"
Дата:
Сообщение: Re: Sequential scan where Index scan expected (update)
Следующее
От: Joost Kraaijeveld
Дата:
Сообщение: Re: Why do I get these results?????