Name ASC does not seem to be working?

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
BrighteyesDesignAsked:
Who is Participating?
 
GaryCommented:
You have spaces at the beginning of your names.
Specifically
London, Bishopsgate EC2
0
 
GaryCommented:
Remove DISTINCT and use GROUP BY City.Name just before your ORDER BY
0
 
lwadwellCommented:
try adding the table name to the column reference in the ORDER BY ... i.e.
ORDER BY city.Name ASC
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Ray PaseurCommented:
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
 
BrighteyesDesignAuthor Commented:
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
 
BrighteyesDesignAuthor Commented:
Would the structure type make a difference? The name column is char(35) latin1_swedish_ci
0
 
Ray PaseurCommented:
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
 
BrighteyesDesignAuthor Commented:
The output without distinct is...output
The company is very reputable here in the UK
City.sql
properties.sql
0
 
BrighteyesDesignAuthor Commented:
Cheers!
0
 
Ray PaseurCommented:
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
 
BrighteyesDesignAuthor Commented:
Thanks Ray, I'd go back and spread the points if could!
0
 
Ray PaseurCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.