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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:38:43+00:00 2026-05-26T07:38:43+00:00

SELECT a.samAccountName FROM activeIds AS a WHERE NOT EXISTS (SELECT * FROM #tmp1 AS

  • 0
SELECT a.samAccountName
FROM   activeIds AS a
WHERE  NOT EXISTS (SELECT *
                   FROM   #tmp1 AS b
                   WHERE  a.samAccountName = b.userID)
       AND a.samAccountName LIKE 'ysp%'
ORDER  BY a.samAccountName ASC;  
GO

I created a temp table that populates User IDs YSP0000 to YSP9999.
I have an existing table (activeIds) that is already populated with YSP IDs.

I’m trying to output YSP IDs that DON’T exist in the existing table (activeIds) already.

For some reason the YSP IDs are not displaying and other IDs (for example ZSP) appear instead.

Is there a way to make the IDs appear?

  • 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-26T07:38:44+00:00Added an answer on May 26, 2026 at 7:38 am

    I believe what you’re looking for is not NOT EXISTS, but NOT IN. Something like this:

    select samAccountName
    from activeIds
    where samAccountId not in
    (
        select badAccountIds
        from #temp1
    )
    

    That will select all account names that IDs are not in the temp table.

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

Sidebar

Related Questions

select count(*) as count from table group by foreign_id order by count This returns
select * from myTable where myInt will not show any possible_keys when explaining the
SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY hrl.Frn) as Row, hrl.unq, hrl.LcnsId, hc.Business,hc.Name,hc.Phone,
(SELECT word, description FROM dictionary WHERE word LIKE 'xxxx%') AS a UNION (SELECT word,
select p.Id, sum(inc.Quantity) from Products p join Incomes inc group by p.Id order by
SELECT DISTINCT field1, field2, field3, ...... FROM table; I am trying to accomplish the
select NAME from Temp_EMP where name not in select NAME from EMPLOYEE and deptid
select * from table where key='çmyk' when i run this query on table that
select count(category) from list where category like 'action' above is a query i want
SELECT P.pID FROM Department D, Professor P WHERE D.dID = P.dID ORDER count(pID); Mysql,

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.