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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:40:29+00:00 2026-06-04T22:40:29+00:00

I did find this post: how do I subtract values from two select statements

  • 0

I did find this post: how do I subtract values from two select statements

but I cannot get it to work on SQL-Server 2008.

I have two basic SELECT statements. No GROUP BYs or anything, just a SELECT, FROM and WHERE.

I would like to subtract one of these SELECTs from the other. Both return one row and column.

Could somebody please help?

SELECT 
    ((SELECT Field1 AS BaseBase FROM Table1
        WHERE Field2 = 'something' 
        AND Field3 = 
           (SELECT Field4 FROM SEL_Function('something','something')) as tab1)
      -     
    ((SELECT Field5 FROM SEL_Function('something','something') as tab2)
  • 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-04T22:40:30+00:00Added an answer on June 4, 2026 at 10:40 pm

    Alright I don’t think the cross apply is necessary fiddle won’t allow functions but check out this fiddle. You will want to swap out the table of the same name with the function. I think you were getting bit by a combination of alias and paren mismatches.

    http://sqlfiddle.com/#!3/dc72f/13

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

Sidebar

Related Questions

I found some threads saying this was doable, but did not find specific instructions
I did a quick search, but couldn't find a specific solution to this (I'm
Sorry if this is a re-post. I did not find a suitable answer. Please
I did not find an answer to this question. I have a VOIP application.
Did some googling and couldn't find a clear answer on this. My assumption is
First of all, I did a search on this and was able to find
I am interested in where string literals get allocated/stored. I did find one intriguing
I need to get the text (if any) between curly brackets. I did find
I was working on this for a while and did not find anything about
I came across this post , which reports the following interview question: Given two

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.