Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2002
    South Africa

    Displays Duplicate Records

    When I print allot of records onto the screen, allot of them are displaying more than once. Some even 6 times.

    I know you can use "GROUP BY" statement, but that doesn't work asswell as it is suppose to.

    Can someone please help me with some query of something else I can use. I write the web appllications in Perl.

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Täby, Sweden
    It has been very long since I last did SQL, but isn't this a perfect use for "SELECT DISTINCT", or whatever it's called?

  3. #3
    Linux Engineer
    Join Date
    Jan 2003
    Lebanon, pa
    Yes DISTINCT will prevent same data from being selected multiple times.

  4. $spacer_open
  5. #4
    Yes select DISTINCT will return only 1 row when previously many were returned, but distinct works on the fact that all data in each row is identical. If the data in each row is slightly different i.e. has a white space then that row will also be returned. Distinct will also slow the query down. Only use distinct as a last resort.

Posting Permissions

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