I have 2 tables.
Table1 contains 4 columns (Id, pt_RFID, sessionTime, sessionDate)
Table2 contains 7 columns (Id, pt_RFID, sessionTime, sessionDate, isTrainerShow, isTraineeShow)
Now, what I would like to achieve is to retrieve the sessionTime from Table1 where Table1.pt_RFID =@pt_RFID, Table2.sessionTime IS NULL and Table1.sessionDate = FORMAT (getdate(), 'yyyy-MM-dd').
The problem is, it did not give me the data that I wanted. Below is my actual Table:
Table1
Table2

Below is my query that obviously is not correct:
- select
- st.sessionTime
- from dbo.tblPT_SessionTime st
- LEFT JOIN dbo.tblPT_Sessions sd ON sd.sessionTime = st.Id
- WHERE sd.sessionTime IS NULL and st.pt_RFID = @pt_RFID AND st.sessionDate = FORMAT (getdate(), 'yyyy-MM-dd')
I hope someone could assist me.

Ashutosh GuptaPosted Dec 10, 2019, 11:30 PM
Amit MohantyPosted Dec 10, 2019, 10:56 PM
Jes SiePosted Dec 10, 2019, 9:24 PM
Ronika JencyPosted Dec 10, 2019, 4:38 AM