[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Name ASC does not seem to be working?

Posted on 2012-08-12
12
Medium Priority
?
410 Views
Last Modified: 2012-08-12
Really can't work this out.

I'm trying to display these name by Name ASC but as you can see by the screenshot Gloucestershire is displaying after London?

Any ideas?

database
0
Comment
Question by:BrighteyesDesign
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 38285316
Remove DISTINCT and use GROUP BY City.Name just before your ORDER BY
0
 
LVL 25

Expert Comment

by:lwadwell
ID: 38285319
try adding the table name to the column reference in the ORDER BY ... i.e.
ORDER BY city.Name ASC
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38285326
You might want to learn about EXPLAIN SELECT.  Helpful for things like this!
http://dev.mysql.com/doc/refman/5.0/en/explain.html
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 

Author Comment

by:BrighteyesDesign
ID: 38285343
Thanks all!

I have tried both of those suggestions but the same results show?

Thanks for the link Ray, can't get my head around it though!
0
 

Author Comment

by:BrighteyesDesign
ID: 38285349
Would the structure type make a difference? The name column is char(35) latin1_swedish_ci
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38285400
Please post the CREATE TABLE statements for the properties and City tables.

Please try the query you showed in the original question with only DISTINCT omitted and show us the output from that.

Is this hosted at a dependable hosting company (ie: a company that would not have any hiccups in its implementation of PHP or MySQL)?
0
 

Author Comment

by:BrighteyesDesign
ID: 38285412
The output without distinct is...output
The company is very reputable here in the UK
City.sql
properties.sql
0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 38285445
You have spaces at the beginning of your names.
Specifically
London, Bishopsgate EC2
0
 

Author Closing Comment

by:BrighteyesDesign
ID: 38285521
Cheers!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38285525
The London, Bishopsgate EC2 has a leading blank.  

(4144, ' London, Bishopsgate EC2', 'GBR', ''),

This causes the appearance that the ORDER clause is not working.  In fact, it's working just fine.  If you correct that you will probably be able to get the results you expect.
0
 

Author Comment

by:BrighteyesDesign
ID: 38285535
Thanks Ray, I'd go back and spread the points if could!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 38285549
You can -- you can use the Request Attention link and ask a moderator to reopen the question.  But don't bother with it for this question -- You have a good answer and I already have enough points to orbit Saturn. ;-)

Best to all, over and out, ~Ray
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month17 days, 17 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question