Posts by Jefferson Lucena • 75 points
3 posts
-
2
votes1
answer214
viewsQ: Count and group by day range
SELECT loc.loc_pac as registro, datediff(dd, pac.pac_nasc, getdate()) as 'dias' from loc with (nolock), pac with (nolock), str with (nolock) where loc.loc_pac <> '' and (loc.loc_pac =…
-
0
votes2
answers121
viewsA: Place row data in columns
with R070ACCseq as ( SELECT numcad, datacc, horacc, seq= row_number() over (partition by numcad, cast(datacc as date) order by datacc, horacc) from R070ACC where datacc between ('2018-16-05') and…
-
5
votes2
answers121
viewsQ: Place row data in columns
SELECT datacc, horacc FROM R070ACC WITH (NOLOCK) WHERE numcad = '2676' AND DATACC between ('2018-16-04') and ('2018-15-05') and oriacc = 'E' In the first column appears the day of the month repeated…