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. select distinct On multiple fields

select distinct On multiple fields

Scheduled Pinned Locked Moved Database
tutorialdatabase
5 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.
  • H Offline
    H Offline
    hamidreza_buddy
    wrote on last edited by
    #1

    Hi i want to know how to do a "select distict" on multiple field. for example suppuse we have a table with field FirstName and LastName. and we want to select all distinct the people in this table with a Query with distinct FName and LName. I know i can use other elegant ways (such as relationship) to do so, but i need to know that query. thanks

    S M B 3 Replies Last reply
    0
    • H hamidreza_buddy

      Hi i want to know how to do a "select distict" on multiple field. for example suppuse we have a table with field FirstName and LastName. and we want to select all distinct the people in this table with a Query with distinct FName and LName. I know i can use other elegant ways (such as relationship) to do so, but i need to know that query. thanks

      S Offline
      S Offline
      Sushant Duggal
      wrote on last edited by
      #2

      Distinct keyword is associated with one row, not with one column. So you can't get distinct rows on the base of two columns.

      Sushant Duggal.

      1 Reply Last reply
      0
      • H hamidreza_buddy

        Hi i want to know how to do a "select distict" on multiple field. for example suppuse we have a table with field FirstName and LastName. and we want to select all distinct the people in this table with a Query with distinct FName and LName. I know i can use other elegant ways (such as relationship) to do so, but i need to know that query. thanks

        M Offline
        M Offline
        M A A Mehedi Hasan
        wrote on last edited by
        #3

        Hello, Did u try group by clause? If not then u may write in the following way to get the distinct value. SELECT FName,LName FROM YourTableName group by FName,LName

        Mehedi Hasan

        S 1 Reply Last reply
        0
        • H hamidreza_buddy

          Hi i want to know how to do a "select distict" on multiple field. for example suppuse we have a table with field FirstName and LastName. and we want to select all distinct the people in this table with a Query with distinct FName and LName. I know i can use other elegant ways (such as relationship) to do so, but i need to know that query. thanks

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          Does data repeats multiple times in fields FName and LName? If so then you can use distinct otherwise try to group, if this doesn't works explain more your question.

          1 Reply Last reply
          0
          • M M A A Mehedi Hasan

            Hello, Did u try group by clause? If not then u may write in the following way to get the distinct value. SELECT FName,LName FROM YourTableName group by FName,LName

            Mehedi Hasan

            S Offline
            S Offline
            Sushant Duggal
            wrote on last edited by
            #5

            I was talking about the distinct keyword. Perhaps, thanks for the query. Regards,

            Sushant Duggal.

            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