need a sql queries on mysql

Hi,
I have an
 Employee table       
EmpId      Varchar      Primary Key
EmpName      Varchar      75
------------------------------------------------
Project table

 EmpId      Varchar      Foreign Key
ProjectId      Varchar      unique - 10
ProjectName      Varchar      60
--------------------------------------------------------------------------
 Task_Detail       table
SlNo      Integer      Pk
EmpId      Varchar      fk(EmpId)
ProjectId       Varchar      fk(ProjectId)
TaskId      Varchar      20
WorkDesc      Varchar      50
Category      Varchar      20
Date      Date       
TimeSpent      Time       
TimeUpdated TimeStamp      


I have an employee as a master table and task_detail table… and Project table
 and want to list down  total number  of  Timespent from start date to end date  for the
particular employee(empName column) with a particular Project(ProjectId column) and particular work decription (WorkDesc column) what will be the query let me know

Thanks
roy_sanuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

plusone3055Commented:
SELECT	 E.EmployeeID
        ,E.EmployeeName
		,P.ProjectID
		,P.ProjectName
		,T.TaskID
		,T.WorkDesc
		,SUM(T.TimeSpent) as TotalTimeSpent
		

		 
         
FROM	 TEmployee E
JOIN     TProjects P 
ON		 E.EmployeeID = P.EmplyoeeID
JOIN     TTaskDetail T
ON		 P.EmployeeID = T.EmployeeID

GROUP BY E.EmployeeID
        ,E.EmployeeName
		,P.ProjectID
		,P.ProjectName
		,T.TaskID
		,T.WorkDesc

ORDER BY  E.EmployeeID
                   ,E.EmployeeName

Open in new window

0
roy_sanuAuthor Commented:
Also i need to query on start date and end date using date column, how i can add this to it...
0
plusone3055Commented:
SELECT	 E.EmployeeID
        ,E.EmployeeName
		,P.ProjectID
		,P.ProjectName
		,T.TaskID
		,T.WorkDesc
		,Date
		

		 
         
FROM	 TEmployee E
JOIN     TProjects P 
ON		 E.EmployeeID = P.EmplyoeeID
JOIN     TTaskDetail T
ON		 P.EmployeeID = T.EmployeeID

GROUP BY E.EmployeeID
        ,E.EmployeeName
		,P.ProjectID
		,P.ProjectName
		,T.TaskID
		,T.WorkDesc
               ,Date

ORDER BY  E.EmployeeID
                   ,E.EmployeeName
                   ,Date

Open in new window

0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

roy_sanuAuthor Commented:
Not clear, what i want is  suppose i want to query for month data  ranging from start date(DATE COLUMN) as  11/02/2015 to end date (DATE COLUMN) 11/30/2015, how that can be set in the above sql....
0
plusone3055Commented:
SELECT	 E.EmployeeID
        ,E.EmployeeName
		,P.ProjectID
		,P.ProjectName
		,T.TaskID
		,T.WorkDesc
		,SUM(T.TimeSpent) as TotalTimeSpent
		

		 
         
FROM	 TEmployee E
JOIN     TProjects P 
ON		 E.EmployeeID = P.EmplyoeeID
JOIN     TTaskDetail T
ON		 P.EmployeeID = T.EmployeeID
AND        P.ProjectID  = T.ProjectID
WHERE    T.DATE BETWEEN  '10-01-2015'  AND '10-31-2015'

GROUP BY E.EmployeeID
        ,E.EmployeeName
		,P.ProjectID
		,P.ProjectName
		,T.TaskID
		,T.WorkDesc
        

ORDER BY  E.EmployeeID
                   ,E.EmployeeName
                 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
roy_sanuAuthor Commented:
i have another criteria where i want to query on a Particular month let say sept 2015 or  Oct 2015, instead start date and end date how that can be done, does it has some built in month function to do that... Let us know
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.