how to get distinct values from one column only

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rahul2310
    New Member
    • Oct 2013
    • 62

    #1

    how to get distinct values from one column only

    I am using access 2010 and trying to write query where i am selecting 5 fields from table and i want distinct values but for first column only
    Code:
    select field1,field2,field3,field4,field5 from tablename;
    As i said i want distinct value in first column only,i added distinct after select but it works for all fields not for only first column
    Last edited by rahul2310; Jan 6 '14, 02:24 PM. Reason: Spelling mistake
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    You may not be using the correct SQL tool for what you want.
    Please provide a sample of your data (if confidential then somehting the resembles the data as closly as possible). Then explain which records you want returned.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      How is it supposed to know which row you want if there are two rows with the same field1 yet the other fields are different?

      Comment

      • zmbd
        Recognized Expert Moderator Expert
        • Mar 2012
        • 5501

        #4
        Exactly Rabbit, hence my request for the dataset and more detail on the desired records returned.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32669

          #5
          Rahul. See Rabbit's post #3, which explains why what you ask for is impossible. Not because it is technically complicated, but simply because it cannot make logical sense.

          Comment

          • rahul2310
            New Member
            • Oct 2013
            • 62

            #6
            ya i agree but i found way to do it i simply used group by in query and fields which are different i selected where and gave criteria in it
            thanks for your replys

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32669

              #7
              Let us be absolutely clear about this, as many others read this than simply those of us contributing to the thread, and your last comment could be very confusing for some.

              You did not find a way to do it, as specified earlier in your question. You may well have found a way to get what you needed. I am not suggesting you are being false with us at all. I merely point out that what you actually asked for is not possible, and there is no way to do that.

              Comment

              Working...