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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:23:40+00:00 2026-05-30T06:23:40+00:00

I was reading (and am still learning) about the difference between the EXISTS and

  • 0

I was reading (and am still learning) about the difference between the EXISTS and IN operators in SQL. Is it possible to change the following statement so it uses an EXISTS rather than IN? I’ve tried but the query is taking a very long time to complete. So I’m obviously doing something wrong.

In the below example would it be more efficient to use EXISTS instead of IN? There would be no more than 10 OperationRecordID records returned from the current sub-query used for the IN statement.

SELECT SPAS.SessionRecordID,
       ( SELECT MIN(TimeValue) AS MinAnaes
           FROM tblTMActualTimes TMAT
          WHERE OperationRecordID IN
                 ( SELECT OperationRecordID
                     FROM tblTMActualOperation TMAO
                    WHERE TMAO.SessionRecordID = SPAS.SessionRecordID
                 )
            AND CFTimeDefinitionID = 'INTOANS'
       ) AS FirstAnaesthetic
  FROM tblSPActualSession SPAS
  • 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-30T06:23:41+00:00Added an answer on May 30, 2026 at 6:23 am

    As said in the comments it depends on the data what is more suitable for the situation. But if you what to do it in an exist you can do it something like this:

    SELECT 
        SPAS.SessionRecordID,
        ( 
            SELECT 
                MIN(TimeValue) AS MinAnaes
            FROM tblTMActualTimes TMAT
            WHERE EXISTS
                     ( 
                        SELECT 
                            NULL
                        FROM 
                            tblTMActualOperation TMAO
                        WHERE 
                            TMAO.SessionRecordID = SPAS.SessionRecordID
                            AND TMAT.OperationRecordID=TMAO.OperationRecordID
                     )
                AND CFTimeDefinitionID = 'INTOANS'
           ) AS FirstAnaesthetic
      FROM 
        tblSPActualSession SPAS
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After reading some material on this subject I'm still not sure what the difference
I'm learning about software engineering and design right now, and after reading some books
I been reading on asp.net mvc learning site about JavaScript injection and man it
I am just now learning about function pointers and, as I was reading the
... and thanks for reading... I'm still learning the ropes so please be forgiving...
I was reading O'Reilly's Learning XML Book and read the following HTML was in
I am learning about COM and reading about this code: STDMETHODIMP_ (ULONG) ComCar::Release() {
Been reading about map/reduce here and on other sites and I'm still not sure
I'm still learning JavaScript,reading books,utilizing FireBug,experimenting. I'm amazed and stuck on thing below. Have
Learning Javascript and have a question about global variables. From my reading, most recommend

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.