I have a list of musical events from different singers, each singer has different concerts, i need to extract the 'next event' in such a way that for every singer I choose the next occurrence and only the next one
for example for this table
id | singerId | occurrence
1 | 1 | 2017-01-01
2 | 1 | 2017-02-01
3 | 2 | 2017-03-01
4 | 2 | 2017-04-01
result should be
id | singerId | occurrence
1 | 1 | 2017-01-01
3 | 2 | 2017-03-01
I've tried with
select distinct * from table
where occurrence > '2016-12-12 22:10:00'
group by singerId
order by occurrence
but somehow I am not getting the next occurrence in all cases, sometimes an occurrence is one in the middle, not the next one
'next' is the closest to 2016-12-12 22:10:00 greater than it
What is wrong in my query?