homepage Welcome to WebmasterWorld Guest from 54.205.254.108
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
how do u show a result once?
union_jack




msg:1579687
 8:56 am on Sep 28, 2005 (gmt 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?

 

SuzyUK




msg:1579688
 9:40 am on Sep 28, 2005 (gmt 0)

try..
SELECT
distinct FROM data1 where town between 'A%' and 'E%' ORDER BY town
union_jack




msg:1579689
 9:46 am on Sep 28, 2005 (gmt 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

SuzyUK




msg:1579690
 10:05 am on Sep 28, 2005 (gmt 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.

union_jack




msg:1579691
 10:35 am on Sep 28, 2005 (gmt 0)

that's got it thanks for your help

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved