Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting things in a weird order... (a very ghetto query)

Status
Not open for further replies.
Feb 14, 2002
88
JP
First: Yes, I know about "ORDER BY"

Okay, putting that aside, here's my problem. I've got rows that I need to sort by their Japanese title. I've actually made an entire "reading" column, with everything in katakana. Even so, the version of MySQL my provider has doesn't know how to sort non-latin characters. The workaround I've chosen is to grab an entire set of records, throw it into an array, sort that, and then grab my 15 records that I want (in Japanese-alphabetized order). It looks something like this:

Choose name,age FROM table
WHERE name = Tom
OR name = Bob
OR name = Pete

It becomes a very long query, but it works, except for one thing. The query returns results in the order they are saved in the DB... not the order in which I ask them. I understand why, but I'm wondering if there's away I can sort things in the order in which I've asked for them in. In other words, I'd want the above query to return
Tom
Bob
Pete

I know this is pretty non-conformed, but I can't think of any other way to do it other than have my provider upgrade MySQL with jp-euc support, which I doubt they will. I know the other option is to run 15 queries, but that seems like an awful lot of overhead.
 
I guess there's really nothing stopping me from sorting everything again in PHP once I get it. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top