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

The Archive Base Latest Questions

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

Need some help on this query. So far I have it returning a count

  • 0

Need some help on this query. So far I have it returning a count based on data from couple days previous.

What I am ultimately trying to do now is create a query that basically tells me if the count(*)=Xn value, then query is valid else no data set.

Its ok if I get no results.

Here’s my query:

    SQL> select count(*) from in_source where to_date(year||'/'||month||'/'||day, 'YYYY/MM/DD') >= trunc(sysdate) - 1;

  COUNT(*)
----------
  500

So, basically if count(*)=500 then this query is 1 (false) or 0 (no results). I’m thinking this would require a sub query?

Can someone help me tweak this? Thank you.

  • 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-23T09:40:39+00:00Added an answer on May 23, 2026 at 9:40 am

    Don’t really understand what you are after, but hopefully one of these will work..

    If you are trying to get if count(*) = 500 return a 1 else return a 0 then try this:

    select case when count(*) = 500 then 1 else 0 end result
    from in_source
    where to_date(year||'/'||month||'/'||day, 'YYYY/MM/DD') >= trunc(sysdate) - 1;
    

    If you are trying to get if count(*) = 500 then return a 1 else don’t return any rows try this:

    select 1 result
    from in_source
    where to_date(year||'/'||month||'/'||day, 'YYYY/MM/DD') >= trunc(sysdate) - 1
    having count(*) = 500;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need some help with putting this query together. I'm using Mysql I have two
Just need some help to refine this query if possible. SELECT * FROM E_Associates
I need some help from the shell-script gurus out there. I have a .txt
I need some help with a query - I'm using Firebird 2.1. I have
i need some help with this sql query heres my mysql table structure: DOMAINS
Hi I need some help with the following scenario in php. I have a
I am new to all the anonymous features and need some help. I have
I'm working with jQuery for the first time and need some help. I have
Guys, I need some help! I have a fully rendered menu (a safe html
Hey guys need some more help I have 3 tables USERS, PROFILEINTERESTS and INTERESTS

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.