1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Loops and MySql

Discussion in 'PHP' started by kc3, Jul 23, 2005.

  1. #1
    I don't how know how to explain this so take the following table as an example.

    --- Id -|- Name -|- Value -|- field_id ---

    With the following entrys

    --- 1 -|- Ex1 -|- Ex_value1 -|- 555 ---
    --- 2 -|- Ex2 -|- Ex_value2 -|- 555 ---
    --- 3 -|- Ex3 -|- Ex_value3 -|- 555 ---
    --- 4 -|- Ex1 -|- Ex_nonv1 -|- 789 ---
    --- 5 -|- Ex2 -|- Ex_nonv2 -|- 789 ---
    --- 6 -|- Ex3 -|- Ex_nonv3 -|- 789 ---
    --- 7 -|- Ex1 -|- Ex_anoth1 -|- 123 ---
    --- 8 -|- Ex2 -|- Ex_anoth2 -|- 123 ---
    --- 9 -|- Ex3 -|- Ex_anoth3 -|- 123 ---

    I need to be to find all of the unique numbers in the field_id column when it comes back I don't want the results to be 555, 555, 555, 789, 789, etc... But rather 555, 789, 123. How would I go about doing this?

    Please help me, I realy need to do this.
     
    kc3, Jul 23, 2005 IP
  2. morewords

    morewords Guest

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SELECT DISTINCT field_id FROM ...
     
    morewords, Jul 23, 2005 IP
  3. kc3

    kc3 Peon

    Messages:
    857
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you VERY much. I just got back from a trip and I'll be sure to use this. Thanks
     
    kc3, Jul 31, 2005 IP