How to select data from RequestesEmail table based on two condition on same time ?
- CREATE TABLE [dbo].[RequestsEmail](
- [EmialRequestID] [int] IDENTITY(1,1) NOT NULL,
- [RequestID] [int] NULL,
- [EmailID] [nvarchar](250) NULL,
- [ReplyToID] [nvarchar](250) NULL,
- [EmailDate] [datetime] NULL,
- ) ON [PRIMARY]
- INSERT [dbo].[RequestsEmail] ( [RequestID], [EmailID], [ReplyToID], [EmailDate])
- VALUES ( 39502, N'[email protected]', N'[email protected]','2020-03-17 05:08:11.740')
- INSERT [dbo].[RequestsEmail] ( [RequestID], [EmailID], [ReplyToID], [EmailDate])
- VALUES ( 39504, N'[email protected]', N'[email protected]','2019-05-05 05:08:11.740')
- INSERT [dbo].[RequestsEmail] ( [RequestID], [EmailID], [ReplyToID], [EmailDate])
- VALUES ( 39504, N'[email protected]', NULL,'2020-03-17 05:10:11.740')
- INSERT [dbo].[RequestsEmail] ( [RequestID], [EmailID], [ReplyToID], [EmailDate])
- VALUES ( 39504, N'[email protected]', NULL,'2020-03-17 05:15:11.740')
- INSERT [dbo].[RequestsEmail] ( [RequestID], [EmailID], [ReplyToID], [EmailDate])
- VALUES ( 39504, N'[email protected]', N'[email protected]','2018-02-09 05:15:11.740')
all data on table as below
EmialRequestID RequestID EmailID ReplyToID EmailDate
desire result is
EmialRequestID RequestID EmailID ReplyToID EmailDate
Actually i need to make select statement display or show all data on table RequestEmail above structure
where
first condtition
ReplyToID is null and EmailDate equal datetoday
and also second condition
select EmailID where equal ReplyToID and EmailDate is dateToday
two condition on same time must show .
so how to do that please ?