I have on requirement, where i need to display data like below
SELECT PLANID, PlanName, PlanAmount FROM [dbo].[tblPlans] where [IsPlanActive]=1
PLANID PlanName PlanAmount
1 Monthly Plan 20
2 Quarterly Plan 40
3 Semi Annual Plan 60
4 Annual Plan 100
my below query producing data like.
select ((select count(DISTINCT [patientId]) FROM [dbo].[tblSubscriptionTable] where EndDate>GETUTCDATE())) as ActivePatient, ((select count(DISTINCT [patientId]) FROM [dbo].[tblSubscriptionTable] where EndDate<GETUTCDATE())) as InActivePateint, (SELECT Count(*) as TotalPatient FROM [dbo].[tblPatient] where [IsActive]=1) as TotalPatient, (SELECT Count(*) as TotalPatient FROM [dbo].[tbLInsuranceCompany] where [IsActive]=1) as TotalCompany
ActivePatient InActivePateint TotalPatient TotalCompany
4 1 93 5
i want data like below.
label value
Totalpatient 345
Activepatient 567
Inactivepatient 23
in this format how can i change my query.
SELECT PLANID,PlanName,PlanAmount FROM [dbo].[tblPlans] where [IsPlanActive]=1
select ((select count(DISTINCT [patientId]) FROM [dbo].[tblSubscriptionTable] where EndDate>GETUTCDATE())) as ActivePatient,
((select count(DISTINCT [patientId]) FROM [dbo].[tblSubscriptionTable] where EndDate<GETUTCDATE())) as InActivePateint,
(SELECT Count(*) as TotalPatient FROM [dbo].[tblPatient] where [IsActive]=1) as TotalPatient,
(SELECT Count(*) as TotalPatient FROM [dbo].[tbLInsuranceCompany] where [IsActive]=1) as TotalCompany
PLANID PlanName PlanAmount
1 Monthly Plan 20
2 Quarterly Plan 40
3 Semi Annual Plan 60
4 Annual Plan 100
ActivePatient InActivePateint TotalPatient TotalCompany
4 1 93 5