I am having a table called alfa
intime | outime | ID | Accountid |
-----------------------------------------------------------------------------------
2016-06-23 06:53:00.000 | NULL | 1 | 1234 |
NULL | 2016-06-23 17:04:00.000 | 2 | 1234 |
I am expecting the output like
intime | outime | Accountid |
-------------------------------------------------------------------------------------------------
2016-06-23 06:53:00.000 | 2016-06-23 17:04:00.000 | 1234 |
I am trying to run this query:
select * from alfa
where intime is not null
and exists
(select * from alfa as a
where a.accountid=alfa.accountid
and out is not null)
But it not giving me the output as expected.