Click here to Skip to main content
15,890,336 members
Home / Discussions / Database
   

Database

 
AnswerRe: SQL Table Grouping Pin
Paul Conrad20-Aug-12 6:26
professionalPaul Conrad20-Aug-12 6:26 
GeneralRe: SQL Table Grouping Pin
milo-xml20-Aug-12 6:36
professionalmilo-xml20-Aug-12 6:36 
AnswerRe: SQL Table Grouping Pin
Paul Conrad20-Aug-12 6:43
professionalPaul Conrad20-Aug-12 6:43 
GeneralRe: SQL Table Grouping Pin
milo-xml20-Aug-12 8:45
professionalmilo-xml20-Aug-12 8:45 
GeneralRe: SQL Table Grouping Pin
Paul Conrad20-Aug-12 8:52
professionalPaul Conrad20-Aug-12 8:52 
GeneralRe: SQL Table Grouping Pin
Paul Conrad20-Aug-12 6:22
professionalPaul Conrad20-Aug-12 6:22 
AnswerRe: SQL Table Grouping Pin
Blue_Boy20-Aug-12 22:15
Blue_Boy20-Aug-12 22:15 
AnswerRe: SQL Table Grouping Pin
i.j.russell20-Aug-12 23:47
i.j.russell20-Aug-12 23:47 
Try this [not tested but it should work!]

SQL
SELECT t1.PI,
    t1.JobID,
    t1.FormID,
    t1.ShiftID,
    t2.StartEvent,
    t2.SW,
    t2.SG,
    t3.EndEvent,
    t3.EG,
    t3.EW
FROM
    (
        SELECT DISTINCT PI, JobID, FormID, ShiftID
        FROM [table]
    ) t1
    CROSS APPLY
        (
            SELECT TOP 1 StartEvent, SW, SG
            FROM [table]
            WHERE PI = t1.PI
                AND JobID = t1.JobID
                AND FormID = t1.FormID
                AND ShiftID = t1.ShiftID
            ORDER BY StartEvent ASC
        ) t2
    CROSS APPLY
        (
            SELECT TOP 1 EndEvent, EG, EW
            FROM [table]
            WHERE PI = t1.PI
                AND JobID = t1.JobID
                AND FormID = t1.FormID
                AND ShiftID = t1.ShiftID
            ORDER BY EndEvent DESC
        ) t3

GeneralRe: SQL Table Grouping Pin
milo-xml21-Aug-12 3:03
professionalmilo-xml21-Aug-12 3:03 
GeneralRe: SQL Table Grouping Pin
i.j.russell21-Aug-12 3:53
i.j.russell21-Aug-12 3:53 
GeneralRe: SQL Table Grouping Pin
milo-xml21-Aug-12 4:42
professionalmilo-xml21-Aug-12 4:42 
AnswerRe: SQL Table Grouping Pin
Niladri_Biswas21-Aug-12 22:26
Niladri_Biswas21-Aug-12 22:26 
AnswerRe: SQL Table Grouping Pin
__TR__21-Aug-12 22:28
__TR__21-Aug-12 22:28 
AnswerRe: SQL Table Grouping Pin
milo-xml22-Aug-12 7:54
professionalmilo-xml22-Aug-12 7:54 
AnswerRe: SQL Table Grouping Pin
Michael Potter23-Aug-12 6:16
Michael Potter23-Aug-12 6:16 
Questionssis database reocords to execel sheet Pin
vasu1219-Aug-12 18:56
vasu1219-Aug-12 18:56 
Questionconverting console base application to windows form Pin
shaikh-adil17-Aug-12 7:45
shaikh-adil17-Aug-12 7:45 
AnswerRe: converting console base application to windows form Pin
Eddy Vluggen17-Aug-12 7:57
professionalEddy Vluggen17-Aug-12 7:57 
GeneralMessage Closed Pin
17-Aug-12 8:03
shaikh-adil17-Aug-12 8:03 
GeneralRe: converting console base application to windows form Pin
Paul Conrad17-Aug-12 8:27
professionalPaul Conrad17-Aug-12 8:27 
GeneralMessage Closed Pin
17-Aug-12 8:36
shaikh-adil17-Aug-12 8:36 
GeneralRe: converting console base application to windows form Pin
Paul Conrad17-Aug-12 9:21
professionalPaul Conrad17-Aug-12 9:21 
SuggestionRe: converting console base application to windows form Pin
Eddy Vluggen17-Aug-12 10:17
professionalEddy Vluggen17-Aug-12 10:17 
GeneralMessage Closed Pin
17-Aug-12 19:37
shaikh-adil17-Aug-12 19:37 
GeneralRe: converting console base application to windows form Pin
Eddy Vluggen17-Aug-12 23:02
professionalEddy Vluggen17-Aug-12 23:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.