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

The Archive Base Latest Questions

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

I had posted a similar question earlier – a slightly different requirement here. I

  • 0

I had posted a similar question earlier – a slightly different requirement here.

I have a textBox which returns the user-selected ‘Number‘ value.(eg. : 100,200,300)

What needs to be done is basically check a table MyTable if a record/records exist for the particular Number value selected by user. If it returns NULL, then I need to return the records for the default Number value of 999.

MyTable:
id Number MyVal
1  100    55
2  200    66
3  400    22
4  400    12
5  999    23
6  999    24

Here’s what I have so far :(Assuming textBoxInput(Number) = 300)

SELECT Myval 
from MyTable 
where id in (
    SELECT ISNULL(
        SELECT id 
            from MyTable 
            where Number=300, 
        select id 
            from MyTable 
            where Number = 999
    )
)

So here, since Number=300 does not exist in the table, return the records for Number=999.

But when I run this query, I’m getting an error ‘Subquery returned more than 1 value…’

Any suggestions/ideas?

  • 1 1 Answer
  • 1 View
  • 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:33:24+00:00Added an answer on May 30, 2026 at 6:33 am

    This should work:

    SELECT Myval 
    from MyTable 
    where Number = @Number
    OR (NOT EXISTS(SELECT * FROM MyTable WHERE Number = @Number) AND Number = 999)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have already posted a similar question here, but failed to get a response
I had posted one question earlier jQuery inconsistency in setting readonly attribute in IE-8
[I posted a similar question on serverfault.com, but had very little feedback so trying
I had posted this earlier on Stack Overflow, but couldn't get a positive result.
I had posted a question in regards to this code. I found that JTextArea
I've looked at similar questions posted here as well as did a basic Google
Hello I posted a few days ago a similar question and I was told
I am using a C1ReportViewer control, and have already posted a question on the
This is similar to the problem posted here , but that solution doesn't work
I posted a question earlier about why django redirect was not working correctly, but

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.