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. sql2000 + distinct rows

sql2000 + distinct rows

Scheduled Pinned Locked Moved Database
database
6 Posts 4 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.
  • R Offline
    R Offline
    ritu4321
    wrote on last edited by
    #1

    i have a query in sql2000 if i want to select distinct scid,requirement,comments from table1 i am not getting distinct rows . distinct keyword is not working .can you please give me some clue.it is urgent.

    A H 2 Replies Last reply
    0
    • R ritu4321

      i have a query in sql2000 if i want to select distinct scid,requirement,comments from table1 i am not getting distinct rows . distinct keyword is not working .can you please give me some clue.it is urgent.

      A Offline
      A Offline
      Alsvha
      wrote on last edited by
      #2

      My guess is that the DISTINCT keyword is working but that your rows aren't - well - distinct.

      --------------------------- Blogging about SQL, Technology and many other things

      R 1 Reply Last reply
      0
      • A Alsvha

        My guess is that the DISTINCT keyword is working but that your rows aren't - well - distinct.

        --------------------------- Blogging about SQL, Technology and many other things

        R Offline
        R Offline
        ritu4321
        wrote on last edited by
        #3

        its taking more than two columns combined distinct

        A S 2 Replies Last reply
        0
        • R ritu4321

          its taking more than two columns combined distinct

          A Offline
          A Offline
          Alsvha
          wrote on last edited by
          #4

          Yes, that is how DISTINCT works. The entire selected row must be identical to others for them to be filtered away.

          --------------------------- Blogging about SQL, Technology and many other things

          1 Reply Last reply
          0
          • R ritu4321

            its taking more than two columns combined distinct

            S Offline
            S Offline
            SomeGuyThatIsMe
            wrote on last edited by
            #5

            Distinct runs on every column after it unless you put the column list in parenthesis () like SELECT Distinct(col1), col2,col3 you can also group columns in the distinct clause or combine them if they are character strings like SELECT Distinct (Col1 + Col2), col3 distinct will only operate on the column specified, but in your syntax you are accidently specifying all of the columns, and i imagine that you dont have 2 rows where all 3 columns contain the same data. Oh before i forget, Sql Server 2000's query analyzer tool has the absolute best help under help -> tranact SQL help. it is very well written and has fairly good examples, i use it all the time.

            1 Reply Last reply
            0
            • R ritu4321

              i have a query in sql2000 if i want to select distinct scid,requirement,comments from table1 i am not getting distinct rows . distinct keyword is not working .can you please give me some clue.it is urgent.

              H Offline
              H Offline
              Hesham Amin
              wrote on last edited by
              #6

              Do you have text or ntext columns in this table? because as I remember, distinct won't work fine with them.

              Hesham A. Amin My blog

              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