Welcome to WebmasterWorld Guest from 54.163.49.19

Forum Moderators: open

Message Too Old, No Replies

how do u show a result once?

     
8:56 am on Sep 28, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 1, 2003
posts:145
votes: 0


I am using the below statment to bring back results for towns beginning with A to E.

SELECT * FROM data1 where town between 'A%' and 'E%' ORDER BY town

But because I multipule entries the results are for example:

Aberdeen
Aberdeen
Aberdeen
Abingdon
Abingdon

How do I get it to return just the one result per town?

Thanks for any help?

9:40 am on Sept 28, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Oct 1, 2002
posts:5199
votes: 0


try..
SELECT distinct FROM data1 where town between 'A%' and 'E%' ORDER BY town
9:46 am on Sept 28, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 1, 2003
posts:145
votes: 0


mmm.. got an error

Warning: Supplied argument is not a valid MySQL result

Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM golf where town between 'A%' and 'E%'

any ideas

10:05 am on Sept 28, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Oct 1, 2002
posts:5199
votes: 0


.. sorry try

SELECT DISTINCT 'town' FROM 'data1' where 'town' between 'A%' and 'E%' ORDER BY 'town'

forgot to put in town, but it's the "DISTINCT" that should get your one result.

10:35 am on Sept 28, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 1, 2003
posts:145
votes: 0


that's got it thanks for your help