473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is this "order by" logic right

Hello list,

The query has the following in the where:

UPPER(cty_Name) LIKE 'NEW%' ORDER BY cty_name

it returns the data in this way:

Newark
Newark
New Britain
Newburgh
New Cannan
New Castle
Newcomerstown

The table has index on cty_name (btree), I'll appreciate any comments or
suggestions about it.

Thanks

--
Josué Maldonado.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #1
4 1557
On Wed, 24 Sep 2003, [ISO-8859-1] Josué Maldonado wrote:
Hello list,

The query has the following in the where:

UPPER(cty_Name) LIKE 'NEW%' ORDER BY cty_name

it returns the data in this way:

Newark
Newark
New Britain
Newburgh
New Cannan
New Castle
Newcomerstown

The table has index on cty_name (btree), I'll appreciate any comments or
suggestions about it.


You haven't given your locale or system type, but this seems reasonably
if you're in a locale that generally ignores spaces (for example my redhat
machine does so in en_US). If you want byte order sorting, you'll
probably need to re-initdb with LC_COLLATE set to "C"
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2
Hi Stephan,

Stephan Szabo wrote:
On Wed, 24 Sep 2003, [ISO-8859-1] Josué Maldonado wrote:
You haven't given your locale or system type, but this seems reasonably
if you're in a locale that generally ignores spaces (for example my redhat
machine does so in en_US). If you want byte order sorting, you'll
probably need to re-initdb with LC_COLLATE set to "C"


The db was initialized with the defaults in postgresql.conf, so the
locale is en_US. Any idea how to change it?

--
Josué Maldonado.

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #3
On Wed, 24 Sep 2003, [ISO-8859-1] Josué Maldonado wrote:
Hi Stephan,

Stephan Szabo wrote:
On Wed, 24 Sep 2003, [ISO-8859-1] Josué Maldonado wrote:
You haven't given your locale or system type, but this seems reasonably
if you're in a locale that generally ignores spaces (for example my redhat
machine does so in en_US). If you want byte order sorting, you'll
probably need to re-initdb with LC_COLLATE set to "C"


The db was initialized with the defaults in postgresql.conf, so the
locale is en_US. Any idea how to change it?


Unfortunately, the only real way to change the collation right now is to
re-initdb with LC_COLLATE set to something else in the environment. The
index order for btree indexes is dependant on the collation order so
changing it after the fact would be bad. This does mean dumping and
reloading or some kind of replication to get the data between the old
system and new.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #4
What should we comment on?

翽 wrote:
Hello list,

The query has the following in the where:

UPPER(cty_Name) LIKE 'NEW%' ORDER BY cty_name

it returns the data in this way:

Newark
Newark
New Britain
Newburgh
New Cannan
New Castle
Newcomerstown

The table has index on cty_name (btree), I'll appreciate any comments
or suggestions about it.

Thanks

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
1
by: Simon Wigzell | last post by:
Is it possible to retrieve data with ASP sorted on 2 fields? I've tried : SELECT * FROM ORDER By Field1 AND Field 2 But it gives an error. I've searched the internet on this topic to no avail....
1
by: Tobias | last post by:
Need help: In Visual C++ 6 there was a feature "function called by" which could be reached by right-mouse-button-clicking on a function in the class view. I can't find the feature in .NET. Does it...
3
by: Ptbrady | last post by:
"Order By" fails in form for linked table. -------------- My A2K database has worked well for several years, but now has been split into front-end/back-end and has the following problem. I have a...
9
by: Frederik | last post by:
Hi all, I'm building a C# application that uses a M$ Acces database. In one of the queries I use something like the following: SELECT id FROM mytable WHERE id IN (20, 12, 21, 14) The result...
3
by: kartik | last post by:
Hi, I have a huge table with ID, Name and other info. ID can be either 1 or 2 or 3. I wish to create a query which sorts the data by ID, but in this order 2,1 and then 3. Is there any way to use...
7
by: Giles | last post by:
An ASP page outputs data from the query "Select ThisAndThat from comments WHERE pageURL='" & pageURL & "' ORDER BY threadID, datesent" (Access mdb) threadID is a string (OK, I know!), which means...
2
by: Richard Hollenbeck | last post by:
I have the following query in a combo box: SELECT courses.courseCode, courses.courseDescription FROM courses ORDER BY courseDescription; I want to change the "ORDER BY" to display in...
3
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Here is my loop and it runs fine: ---------------------------------------------------- sSQL = "SELECT * FROM STORE_ITEMS" Set DataRec = DB.execute(sSQL) if not DataRec.EOF then do while not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.