SELECT *
FROM table
WHERE id>(SELECT max(id)
FROM table
WHERE date < CURDATE())
LIMIT 10
select datatime,
sum(case when card = 1 then amount else 0 end) as 'Cards1',
sum(case when card = 2 then amount else 0 end) as 'Cards2',
sum(case when card = 3 then amount else 0 end) as 'Cards3'
from service
group by datatime