SELECT Count(type) FROM tblattendancelog WHERE dutydatetime>= DATEADD(day, DATEDIFF(day,0,getdate()), 0)
this uper line edit down code me edit
USE [BiometricDB]
GO
/****** Object: StoredProcedure [dbo].[sp_GetTotalCountReport] Script Date: 26/10/2022 03:28:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_GetTotalCountReport]
AS
BEGIN
-- Get Total Count Report
SELECT
[member].[Total Members], [onleave].[Total Onleave] ,[Present].[Total Present]
FROM
(
-- Total Memebers
SELECT
COUNT(volunteerid) AS [Total Members], 1 AS [Id]
FROM
tblvolunteer
WHERE
[dateofleaving] = '' OR [dateofleaving] IS NULL
) [member] INNER JOIN
(
-- Total OnLeave
SELECT
COUNT(leaverecordid) AS [Total Onleave], 1 AS [Id]
FROM
tblvolunteerleaverecord
WHERE
[todate] >= GETDATE()
) [onleave] ON [member].[Id] = [onleave].[Id]
END
Amit MohantyPosted Oct 26, 2022, 5:58 AM
Try this
Muhammad Imran AnsariPosted Oct 26, 2022, 5:54 AM
You question is not clear, what you want to achieve?
If you want to add abover query result in main query, mention the condition for join clause
If you want to add in existing sub query then also need to define the condition for join clause
OR you need to define your problem clearly with table structure.