In SQL Server need to check if result from a select is some date in the where clause.
Tried this doing below. but failed. Need help with the same.
(SELECT FLDMODDATE
FROM EMPLOYEE
WHERE FLDRECNUMBER = 432893) = '2019-02-05'
I think you want exists
:
select (case when exists (SELECT 1
FROM EMPLOYEE
WHERE FLDRECNUMBER = 432893 and FLDMODDATE = '2019-02-05'
)
then 'true' else 'false'
end)
Or, if this is in T-SQL code:
if exists (SELECT 1
FROM EMPLOYEE
WHERE FLDRECNUMBER = 432893 and FLDMODDATE = '2019-02-05'
)
You need an IF
of some sort.
IF (select FLDMODDATE from EMPLOYEE where FLDRECNUMBER = 432893) = '2019-02-05'
BEGIN
<Code here to do something>
END
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.