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

  • SEARCH
  • Home
  • 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 872943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:51:32+00:00 2026-05-15T10:51:32+00:00

Not even how to word this question: I have a table that looks like

  • 0

Not even how to word this question: I have a table that looks like this:

select * from tblServiceUsers
ORDER By ServiceID

0   B88230BB-4943-4C10-AB0E-8ABB88A357A3
0   5653C943-7F9A-4746-B2A3-1160E9204A7E
0   08678EE7-49A7-4F63-BC39-CFCCE2C9AD65
1   B88230BB-4943-4C10-AB0E-8ABB88A357A3
1   5653C943-7F9A-4746-B2A3-1160E9204A7E
2   B88230BB-4943-4C10-AB0E-8ABB88A357A3
2   5653C943-7F9A-4746-B2A3-1160E9204A7E




And I need a query that only returns the top (or first) userid that matches a serviceID.
For example, I just want 1 UserID to be displayed for each ServiceID. Such as the following:

0   B88230BB-4943-4C10-AB0E-8ABB88A357A3
1   B88230BB-4943-4C10-AB0E-8ABB88A357A3
2   B88230BB-4943-4C10-AB0E-8ABB88A357A3

  • 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-05-15T10:51:33+00:00Added an answer on May 15, 2026 at 10:51 am

    You don’t say which version of SQL server it is, but for MS SQL Server 2005 onwards you can do something like :

     Select SecID, ServiceID, UserID from 
     (
        select ROW_NUMBER() OVER (PARTITION BY ServiceID ORDER BY Secid) AS row_number,
        SecID,
        ServiceID,
        UserID
        From tblSecServiceUsers
     ) 
     tempTable
     where row_number = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not even sure how to ask this question. I want something that
I'm really not sure how to word this question, but here goes... I have
I'm not even sure how to word the question correctly. I have a web
Not even sure I'm stating the question correctly. Here's the situation. I have a
Im not even sure how to ask this question, but i'll give it a
I'm not even sure how I should phrase this question. I'm passing some CustomStruct
I'm not even quite sure how to word my question, so I'll just show
I'm not exactly sure how to word this question, so sorry in advance for
Ok before you think Not another question like this please read this first. I
I am not really sure how to accurately word this question, but you will

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.