Skip to main content
December 12, 2011
Answered

Multiple outputs

  • December 12, 2011
  • 1 reply
  • 688 views

I made this webpage that will display products and where they are located. I am trying to set it up to allow the user to only show the products in their area. I am using a jump menu to display from the query all the provinces they are in, but the cfoutput is displaying ALL the locations even though they are duplicates. is there a way to prevent the return from doing so.

For example:

78 Chevy, Toronto ON

2003 Toyota, Toronto ON

65 ford, Toronto ON.

Now on the jump menu (or if you know a better method) i only want it to display "ON" once, instead it's returning ON 3 times in the drop down menu. Is there a way to prevent that?

Thanks

    This topic has been closed for replies.
    Correct answer Dan_Bracuk

    How about

    select distinct province
    from SaleItems

    order by province

    1 reply

    Inspiring
    December 12, 2011

    How are you storing your data?  Is "their area" a separate field in one of your database tables?

    December 12, 2011

    The database goes like so.

    ItemID

    ItemName

    City

    Province

    Seller

    ContactNumber

    Price

    -- SQL --

    <cfquery database="" name="">

    SELECT *

    FROM SaleItems

    ORDER BY Province

    </cfquery>

    Dan_BracukCorrect answer
    Inspiring
    December 12, 2011

    How about

    select distinct province
    from SaleItems

    order by province