Welcome to WebmasterWorld Guest from 107.22.87.205

Forum Moderators: open

Message Too Old, No Replies

how do u show a result once?

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

10+ Year Member



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 Sep 28, 2005 (gmt 0)

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



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

10+ Year Member



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 Sep 28, 2005 (gmt 0)

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



.. 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 Sep 28, 2005 (gmt 0)

10+ Year Member



that's got it thanks for your help
 

Featured Threads

Hot Threads This Week

Hot Threads This Month