Results 1 to 2 of 2

Thread: SQL Statement Help

  1. #1
    747
    Guest

    SQL Statement Help

    How can I get rid of duplicates records and also get to know how many records were there?

    Let's say I have a 5 same records in the table, I know I can get that in one records by DISTINCT but is there any way of knowing that table has 5 same records.

    I hope you get my point

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    You could GROUP by the Distinct Field(s) then use a COUNT() to get the no. of records, i.e.
    SELECT COUNT(FIELD1) AS Records, FIELD1 FROM TABLE1 GROUP BY FIELD1 ORDER BY FIELD1

Posting Permissions

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



Click Here to Expand Forum to Full Width