Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Distinct Results?

    Can somebody tell how I can prevent duplicate rows from printing queries? I know it's something like this $query ="SELECT DISTINCT ip_address FROM logs";, but I can't get the other fields to print when using this method.

    Here's a list of all the fields that I currently have printing out.

    $query = "SELECT id, time, ip_address, hostname, referrer FROM logs";

    How can I do this using DISTINCT?


    John

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    SELECT DISTINCT ip_address, id, time, hostname, referrer FROM logs;
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •