I wrote following SQL command
select * from [Monitoring].[dbo].[MaintTaskMonitor]
where (JobStartDate,TaskType) in (
select max(JobStartDate),TaskType from [Monitoring].[dbo].[MaintTaskMonitor] where systemname='Dido'
group by TaskType)
which gave the following error:
An expression of non-boolean type specified in a context where a condition is expected, near ','.
Where is the problem from?
1条答案
按热度按时间mgdq6dx11#
You could, instead, switch to a correlated subquery and then check the value of
JobStartDate
from the outer scope matches theMAX
value of the inner scope in theHAVING
: