Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Distinct records

Distinct records

Scheduled Pinned Locked Moved Database
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jegastar
    wrote on last edited by
    #1

    Hi All, I want to select all fields without duplication of records. Please help me. Jegastar

    C 1 Reply Last reply
    0
    • J jegastar

      Hi All, I want to select all fields without duplication of records. Please help me. Jegastar

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      jegastar wrote:

      I want to select all fields without duplication of records

      SELECT * FROM MyTable

      This will return exactly one instance of each row in the named table. However, if two rows have the exact same column values then you will get two rows back that look the same. Stricktly speaking if this happens then data model is likely wrong because all rows should be distinct.

      SELECT DISTINCT * FROM MyTable

      This will ensure that if two rows share the same information that only one of them will be returned.


      Upcoming Scottish Developers events: * We are starting a series of events in Glasgow in 2007. Are you interested in a particular subject, or as a speaker? * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

      J 1 Reply Last reply
      0
      • C Colin Angus Mackay

        jegastar wrote:

        I want to select all fields without duplication of records

        SELECT * FROM MyTable

        This will return exactly one instance of each row in the named table. However, if two rows have the exact same column values then you will get two rows back that look the same. Stricktly speaking if this happens then data model is likely wrong because all rows should be distinct.

        SELECT DISTINCT * FROM MyTable

        This will ensure that if two rows share the same information that only one of them will be returned.


        Upcoming Scottish Developers events: * We are starting a series of events in Glasgow in 2007. Are you interested in a particular subject, or as a speaker? * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog | Photos

        J Offline
        J Offline
        jegastar
        wrote on last edited by
        #3

        Thank you.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups