PAGE BREAK AFTER EACH GROUP ORDER BY

  • 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.

  • philand3 (10/27/2016)


    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.

    Inserting page breaks is the job of whatever tool is used to present the data ... this stuff is not generally done in T-SQL.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply