sql query avoid duplication of data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Seren
    New Member
    • May 2007
    • 2

    sql query avoid duplication of data

    I have mysql database, where users register to support a petition. One of the fields is "country". Many from each different countries have signed the petition. I need to find the exact number of countries in the field. I hope this is clear. Thanks.
    Seren
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by Seren
    I have mysql database, where users register to support a petition. One of the fields is "country". Many from each different countries have signed the petition. I need to find the exact number of countries in the field. I hope this is clear. Thanks.
    Seren
    It's clear enough. It's in the Articles section, so until a moderator of this group comes along to move it to the MySQL Forum, you may not get a reply.

    Comment

    • Atli
      Recognized Expert Expert
      • Nov 2006
      • 5062

      #3
      Moved to the MySQL Forums.

      Please refrain from posting questions in the Article section!

      MODERATOR

      Comment

      • pradeep kaltari
        Recognized Expert New Member
        • May 2007
        • 102

        #4
        Originally posted by Seren
        I have mysql database, where users register to support a petition. One of the fields is "country". Many from each different countries have signed the petition. I need to find the exact number of countries in the field. I hope this is clear. Thanks.
        Seren
        Hi,
        You can get the number of countries by using:
        [code=mysql]
        SELECT COUNT(DISTINCT country) FROM table_name
        [/code]
        If you are looking for something else then please revert back.

        Regards,
        Pradeep.

        Comment

        • Seren
          New Member
          • May 2007
          • 2

          #5
          Apologies for posting in the wrong place. Thanks for the reply.

          Comment

          Working...