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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:36:21+00:00 2026-06-15T02:36:21+00:00

SELECT Counting = ISNULL(COUNT(A.Numbers), 0), B.Date AS DateX From Schema1.Table A INNER JOIN Schema2.Table

  • 0
SELECT 
Counting = ISNULL(COUNT(A.Numbers), 0),
B.Date AS DateX
From Schema1.Table A INNER JOIN Schema2.Table B
ON A.xyz=B.xyz
Where B.Date = GetDate()
Group by B.Date

Sometimes, B.Date won’t have today’s date. I would still like to have result output with Counting = 0 and DateX = Todays date.

How would I do that?

Thank you

EDIT by popular demand

A.Numbers = 123;456;789;012,...etc
B.Date = 2012-11-24, 2012-11-24,-212-11-24,2012-11-26

So count for 2012-11-24 = 3 and 2012-11-26 = 1 but there would be no output when I set B.Date to 2012-11-25
I want to show Counting = 0 when B.Date = 2012-11-25

  • 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-15T02:36:22+00:00Added an answer on June 15, 2026 at 2:36 am

    Get rid of your where clause and change your select to

    Counting = (Case when B.Date = GETDATE() then ISNULL(COUNT(A.Numbers),0) else 0 end)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey huys im counting my table with this code: $county = mysql_query(SELECT COUNT(id) from
I have a query: SELECT t.*, tb.UpdateDate FROM #tempBuildings tb INNER JOIN Buildings b
Please consider the following query: SELECT artist.id, COUNT(DISTINCT artist$styles.v_id) FROM artist LEFT JOIN artist$styles
I want to count how many records from another table in the same select
SELECT Id,Date,Name FROM people WHERE DATEPART(hh,Date) >= 7 AND DATEPART(hh,Date) <= 8 Order by
SELECT * From `users` AS `User` LEFT JOIN `selections` AS `Selections` ON (`Selections`.`user_id` =
I have the following MYSQL query: SELECT categories.key, categories.name, count(*) as itemsCount FROM categories
I have the following query: select count(ords.TRACKING_NUM) from Orders ords (NoLock) group by ords.TRACKING_NUM
I have this query: select distinct pdi.height, pdi.width, pj.jobnum , (select count(barcode) from productiondoorinformation
I have a SQL statement to select results from a table. I need to

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.