February 12, 2015 at 1:15 pm
select SERIALNO, Max(TIME)
from dbo.TASK A
join dbo.Status B
on A.TID=B.TID
where A.ID in ('1111',2222')
and A.TYPE='Pen'
group by B.SERIAL_NO, B.TIME
order by BM.TIME
For this query I may get serial no duplicates but times are unique
For that serial no, I have to find the recent time. But if I use group by, I am getting the wrong no
February 12, 2015 at 1:20 pm
Remove TIME from GROUP BY.
Try not to use reserved keywords for names.
February 12, 2015 at 1:58 pm
Yes. I did
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply