Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:45:45+00:00 2026-06-17T06:45:45+00:00

I have a query SELECT * FROM tblMyTable that returns these results: ID |

  • 0

I have a query

SELECT *
FROM tblMyTable

that returns these results:

ID | TypeID | Name
----------------------------------
1DF6EAA0-D0EC-4E4D-9E6B-1779F0E42A82 | 8518A117-F032-61E6-EF15-1917F5B4E795 | AAA
7BB627EC-16CE-40DA-9CC0-A1861277988D | 8518A117-F032-61E6-EF15-1917F5B4E795 | BBB
25B68C46-C03E-4C1F-94BC-7A371B2F1AC3 | DBE7A7EF-5B97-448C-0D2E-5C0C2155A2FA | CCC
AD1A8990-4A57-4F95-BCBD-6112111782B0 | CAE4D031-2C02-2BB8-5D15-FF865A24AD55 | DDD
94C24A30-18EF-471E-8984-6D165EAB566B | A7FE61B5-F4EB-6286-D3A6-72E458D8745C | EEE
D3A7F2E2-DAAF-B991-E41D-105EBB071323 | A7FE61B5-F4EB-6286-D3A6-72E458D8745C | FFF
3EBE7F2F-A05E-FC02-4AE3-27DF6D9A524E | A7FE61B5-F4EB-6286-D3A6-72E458D8745C | GGG

I’d like to filter the results so that there are only distinct TypeIds, so that the results returned are:

ID | TypeID | Name
----------------------------------
1DF6EAA0-D0EC-4E4D-9E6B-1779F0E42A82 | 8518A117-F032-61E6-EF15-1917F5B4E795 | AAA
25B68C46-C03E-4C1F-94BC-7A371B2F1AC3 | DBE7A7EF-5B97-448C-0D2E-5C0C2155A2FA | CCC
AD1A8990-4A57-4F95-BCBD-6112111782B0 | CAE4D031-2C02-2BB8-5D15-FF865A24AD55 | DDD
94C24A30-18EF-471E-8984-6D165EAB566B | A7FE61B5-F4EB-6286-D3A6-72E458D8745C | EEE

How can I change my query to do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:45:47+00:00Added an answer on June 17, 2026 at 6:45 am

    You can apply row_number():

    select id, typeid, name
    from
    (
      select id, typeid, name,
        row_number() over(partition by typeid order by typeid, name) rn
      from yourtable
    ) src
    where rn =1
    

    See SQL Fiddle with Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this sql query select * from table where name like ? but
I have the following query: SELECT * FROM ( `teams` ) WHERE `name` =
I have following query: Select * from Students which retrieves: Id , Name ,
I have this query SELECT t1.Trans_ID FROM (SELECT * FROM Prune WHERE [Name]=I1) AS
I have query: select id, name from categories where parent_id in ( select id
I have a query select * from table where name in ('52 T&M', '60
I have this query: Select * From Player_Chkin_Cs That spits out the result: Player_ID
I have this query: SELECT * FROM Users; Where I get back id name
I have query Select * from table1 where name like '%Whateveruserpassintextbox%' . When user
I have this query: SELECT * From checkfinale where AssociateID = 51 AND `CompletedDate`

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.