maliary Posted May 9, 2009 Share Posted May 9, 2009 Hello, I would like to create a query from a single table with the following columns. SEQNO is a unique key Name ID Amount Date JOBID SEQNO Mark 9 200 1/2/09 1001 1 Peter 3 300 1/2/09 1001 2 Steve 1 200 2/2/09 1001 3 Mark 9 200 3/2/09 1001 1 Peter 3 300 4/2/09 1001 2 Steve 1 200 5/2/09 1001 3 Hally 1 200 5/2/09 1002 3 The query should output in this format by SUBJOBID :- NAME ID 1/2 2/2 3/2 4/2 5/2 JOBID Mark 9 200 NULL 200 NULL NULL 1001 Peter 3 300 NULL NULL 300 NULL 1001 Steve 1 NULL 200 NULL NULL 200 1001 I have been going over pivot queries for this. But I don't seem to get anywhere. Could some one help ? Link to comment https://forums.phpfreaks.com/topic/157459-single-table-pivot-query/ Share on other sites More sharing options...
maliary Posted May 9, 2009 Author Share Posted May 9, 2009 The results are returned as per the date range and jobid entered. Link to comment https://forums.phpfreaks.com/topic/157459-single-table-pivot-query/#findComment-830154 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.