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

  • Home
  • SEARCH
  • 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 6081573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:11:29+00:00 2026-05-23T11:11:29+00:00

This is quite clumsy. Initial info: There’s a clumsy select query eventually returning 0

  • 0

This is quite clumsy.

Initial info: There’s a clumsy select query eventually returning 0 or 1 depending on several conditions. Usually it get’s to select only one row (other data is cut of by where, etc.). The problem occurs when there’s more rows to parse. So the data actually looks like follows:

Status
0
1

instead of

Status
1

Problem: Only one rowed data is needed in return, i.e. if there’s a 1 present in any row, it should 1 returned, otherwise 0.

Condition: It should be done only in a query (no variables, ifs etc.).

Thanks in advance.

  • 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-23T11:11:29+00:00Added an answer on May 23, 2026 at 11:11 am

    If you are sure that 1 and 0 are the only valuesbeing returned, Can’t you use a max over this query to see any 1s..?

    select max(id) result
      from (
      select 1 id from dual
      union all
      select 0 id from dual
    )
    
        RESULT
    ----------
             1
    
      1  select max(id)
      2    from (
      3    select 0 id from dual
      4    union all
      5    select 0 id from dual
      6    union all
      7    select 0 id from dual
      8* )
    SQL> /
    
       MAX(ID)
    ----------
             0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this quite long query that should give me some information about shipments,
I find this quite odd on Microsoft SQL Server: SELECT * FROM deliveries WHERE
I am intentionally leaving this quite vague at first. I'm looking for discussion and
I run into this quite often where a new page is supposedly tested and
I've seen this quite a few times while using Office Interop classes this.CustomXMLParts.Add(MyResources.Data, new
I have this quite popular problem, but have failed to find a solution that
I've edited this quite a bit and bolded my question at this point. I
Why does this quite simple xquery takes 10min to execute in sql server (the
I know I'm not asking this quite right, either. Please help me better form
This is quite a controversial topic, and before you say no, is it really,

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.