Hi all,
How do I need to build a SQL statement to pull only data when all leaveAmount column for an employee is 0. If the total leave amount for the employee is 0, but their at least one leaveamount is not zero, I don't want them.
When the code is working correctly, only the highlighted data needs to be retuned.
USE [AnyDB]
GO
/****** Object: Table [dbo].[Leave] Script Date: 4/13/2022 11:36:33 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Leave](
[EmployeeID] [numeric](18, 0) NULL,
[FirstName] [nchar](10) NULL,
[LastName] [nchar](10) NULL,
[LeaveType] [nchar](10) NULL,
[LeaveDate] [date] NULL,
[LeaveAmount] [numeric](18, 0) NULL
) ON [PRIMARY]
GO