|
sql
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Pivot Query....dates) and I need to display a summary (on the web) that lists the roles down the left column, with the dates along the top, and the numbers needed in the matrix that results from the rows and columns created by roles/dates... Hey, I totally need some help with this, I know its wrong..but I need ALL of the dates, not just a few... Basically I need to sum up the numberneeded by date and by role....anyone out there please help me out on this? --Code select RolesForDateID, ProjectDateID, ProjectDate, ProjectRoleID, NumberNeeded from (Select rfd.RolesForDateID, pd.PrjDateID as ProjectDateID, pd.PrjDate as ProjectDate, rfd.ProjectRoleID, rfd.NumberNeeded from ut_extras_Projects_RolesForDate rfd right outer join ut_extras_projectdates pd on rfd.ProjectDateID = pd.PrjDateID) tmp PIVOT ( SUM(NumberNeeded) For ProjectDate IN (ProjectDate) ) --end code Hi
Without seeing the sample data + an expected result it is really hard to suggest something <Tremmork***@gmail.com> wrote in message Show quote news:5b32f45d-9405-4844-b840-a32088a0c4a9@d27g2000prf.googlegroups.com... > Working on roles for projects (roles are granted and denied based on > dates) and I need to display a summary (on the web) that lists the > roles down the left column, with the dates along the top, and the > numbers needed in the matrix that results from the rows and columns > created by roles/dates... > > > Hey, I totally need some help with this, I know its wrong..but I need > ALL of the dates, not just a few... > > Basically I need to sum up the numberneeded by date and by > role....anyone out there please help me out on this? > > > --Code > select RolesForDateID, ProjectDateID, ProjectDate, ProjectRoleID, > NumberNeeded > from (Select rfd.RolesForDateID, pd.PrjDateID as ProjectDateID, > pd.PrjDate as ProjectDate, > rfd.ProjectRoleID, rfd.NumberNeeded from > ut_extras_Projects_RolesForDate rfd > right outer join ut_extras_projectdates pd > on rfd.ProjectDateID = pd.PrjDateID) tmp > PIVOT > ( > SUM(NumberNeeded) For ProjectDate IN (ProjectDate) > ) > --end code |
|||||||||||||||||||||||