SQL Query

Forum for anything hard- or software related.

Moderator: Moderators

Post Reply
Gen
was flattened
Posts: 126
Joined: Tue Feb 10, 2004 11:06 pm
Location: cl
Contact:

SQL Query

Post by Gen »

Code: Select all

TRANSFORM Sum(RRHH!Hours) AS [Hours by Year]
SELECT RRHH.NumCaso, Proyects.NameProy, Peopole.Lastnames, Peopole.Name, RRHH.Cargo, Sum(RRHH!ValueHoursMan*RRHH!Hours) AS Total
FROM Proyects INNER JOIN (Peopole INNER JOIN RRHH ON Peopole.IdPeopole=RRHH.IdPeopole) ON Proyects.NumCaso=RRHH.NumCaso
WHERE (((Year(RRHH!Date))=2007))
GROUP BY RRHH.NumCaso, Proyects.NameProy, Peopole.Lastnames, Peopole.Name, RRHH.Cargo
PIVOT Month(RRHH!Date);
this is the result
NumCaso, NameProy, Lastnames, Name, Cargo, Total, jan, feb.....

hours month by month, but I need the amount of money month by month, I mean for January Sum(RRHH!ValueHoursMan*RRHH!Hours) on January, the same for feb etc...
Image
BeAViS
ittssaaa marrrioooo!
Posts: 1390
Joined: Wed Apr 06, 2005 5:15 am
Location: it
Contact:

Post by BeAViS »

you didn't say the magic word...
- Killing today in old fashioned way -
- Beware of Beavers -
- :mario: -
Gen
was flattened
Posts: 126
Joined: Tue Feb 10, 2004 11:06 pm
Location: cl
Contact:

Post by Gen »

Ooo.. sorry

PLEASE




abracadabra, ocus focus
Image
Gen
was flattened
Posts: 126
Joined: Tue Feb 10, 2004 11:06 pm
Location: cl
Contact:

Post by Gen »

Code: Select all

TRANSFORM Sum(RRHH!Hours*RRHH!ValueHoursMan) AS [Total]
SELECT RRHH.NumCaso, Proyects.NameProy, Peopole.Lastnames, Peopole.Name, RRHH.Cargo
FROM Proyects INNER JOIN (Peopole INNER JOIN RRHH ON Peopole.IdPeopole=RRHH.IdPeopole) ON Proyects.NumCaso=RRHH.NumCaso
WHERE (((Year(RRHH!Date))=2007))
GROUP BY RRHH.NumCaso, Proyects.NameProy, Peopole.Lastnames, Peopole.Name, RRHH.Cargo
PIVOT Month(RRHH!Date); 
I found the solution by my self, if some one have another solution or fix for my way to do it please help me
Image
Post Reply