TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jes Sie
663
1.2k
282k
Select Value From Table 1 That is NULL From Table 2
Dec 10 2019 1:46 AM
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'
)
Below is the result of the above query and should give me 15 rows since the sessionDate of the 1st row from Table2 is not the current date.
I hope someone could assist me.
Reply
Answers (
4
)
Web Api with ajax.
How to update an excel file that is stored in sharepoint