Here is a suggestion that uses the classic pivot to generate the 4 columns.
-- código #1 v3
with R070ACCseq as (
SELECT numcad, datacc, horacc,
seq= row_number() over (partition by numcad, cast(datacc as date)
order by (SELECT 0))
from R070ACC
where datacc between '2018-04-16' and '2018-05-15'
and numcad = '2676'
and oriacc = 'E'
)
SELECT numcad, datacc,
max(case when seq = 1 then horacc end) as REG1,
max(case when seq = 2 then horacc end) as REG2,
max(case when seq = 3 then horacc end) as REG3,
max(case when seq = 4 then horacc end) as REG4
from R070ACCseq
group by numcad, datacc;
A table is an unordered data set. If it is necessary that for the same date the columns REG1 to REG4 list the values in the order they appear in the example, then it is necessary that there is a column that tells what order the rows are to be manipulated.
-- código #1 v4
set dateformat ydm;
with R070ACCseq as (
SELECT numcad, cast(datacc as date) as datacc,
convert(char(5), dateadd(minute, horacc, 0), 108) as horacc,
seq= row_number() over (partition by numcad, cast(datacc as date)
order by horacc)
from R070ACC
where datacc between '2018-16-05' and '2018-15-06'
and numcad = '2676'
)
SELECT numcad, datacc,
max(case when seq = 1 then horacc end) as REG1,
max(case when seq = 2 then horacc end) as REG2,
max(case when seq = 3 then horacc end) as REG3,
max(case when seq = 4 then horacc end) as REG4
from R070ACCseq
group by numcad, datacc;