Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

PAGE BREAK AFTER EACH GROUP ORDER BY

$
0
0
Dear All,I would like to get query with page break which after each group(preffered_name) results end, my sample code given below which gives without page break ..SELECT preffered_name ,ci.person_num, ci.event_name, CAST(DATEADD(hour,1,dbo.UtcToLocal(ci.creation_date)) AS DATE) AS event_date, CAST(dbo.UtcToLocal(ci.creation_date) AS date) AS in_date, CAST(dbo.UtcToLocal(ci.creation_date) AS time) AS in_time, co.event_name, CAST(dbo.UtcToLocal(co.creation_date) AS date) AS out_date, CAST(dbo.UtcToLocal(co.creation_date) AS time) AS out_time, DATEDIFF(minute, ci.creation_date, co.creation_date) AS mintues FROM TEST ci OUTER APPLY (SELECT TOP 1 creation_date, event_name FROM TEST t WHERE t.person_num = ci.person_num AND t.creation_date > ci.creation_date ORDER BY t.creation_date ) co WHERE ci.event_name = 'CLOCK_IN' AND (co.event_name IS NULL OR co.event_name = 'CLOCK_IN') AND ci.creation_date > GETDATE()-55 order by preffered_name">.can you help.

Viewing all articles
Browse latest Browse all 3145

Trending Articles