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 8051387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:17:35+00:00 2026-06-05T07:17:35+00:00

I have something like this as an sql table: EmplID    SkillID 1780      128 1780      133

  • 0

I have something like this as an sql table:

EmplID  SkillID
1780      128
1780      133
2061      128
2068      128

Lets say I pass in a string to a stored proc as in ‘128,133’.
I have a split function so the sql might be like the following:

SELECT DISTINCT EmplID
FROM EmplSkills
WHERE SkillID IN(SELECT data FROM dbo.Split(@Skills, ','))

You can easily see that by the sql statement we will get 1780, 2061, and 2068. What I really want is to get those EmplID’s where they have both 128 and 133 as Skill Id’s so with that I should only get 1780.

Any ideas how to approach this without a bunch of crazy joins?

Thanks so much.

  • 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-05T07:17:36+00:00Added an answer on June 5, 2026 at 7:17 am
    SELECT EmplID
    FROM EmplSkills
    WHERE SkillID IN(SELECT data FROM dbo.Split(@Skills, ','))
    GROUP BY EmplID
    HAVING COUNT(DISTINCT SkillID) = (SELECT COUNT(*) FROM dbo.Split(@Skills, ','))
    

    Or, if you are using SQL Server, you could use a CTE to make life easier.

    ; WITH Skills AS (
        SELECT DISTINCT data
        FROM dbo.Split(@Skills, ',')
    )
    SELECT EmplID
    FROM EmplSkills
    WHERE SkillID IN ( SELECT data FROM Skills )
    GROUP BY EmplID
    HAVING COUNT(DISTINCT SkillID) = (SELECT COUNT(*) FROM Skills)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Sql Server Table.. it's something like this: Id ...... Column1 ......
I have a SQL table containing train schedules. The table looks something like this:
I have something like this: create table account ( id int identity(1,1) primary key,
I have a table storing millions of rows. It looks something like this: Table_Docs
I have a file with contents something like this: INSERT INTO table VALUES (NULL,'°
I have a table in SQL Server 2008 that looks kind of like this:
Lets say I have this SQL Table id | name | date 1 |
If I had a SQL Server table that looks something like this with some
I was trying to achieve this in SQL, lets say i have a table
I have something like this: Map<String, String> myMap = ...; for(String key : myMap.keySet())

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.