Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question

Status
Not open for further replies.

cards4

Technical User
Dec 9, 2004
38
US
I am writing a SQL statement to return any information based on one criteria. Here's my sample code:

Select Resource_Name, Resource_Manager_Name, sum(weekly_hours) as Weekly_Hours from #Hours
group by resource_name, Resource_Manager_Name
having sum(weekly_hours) = 0

I am using the temp table #Hours to figure out which employees did not put in time for last week ordered by manager. What I want to do is to display the manager name on a Crystal Report regardless if all employees put in time or not from last week. However, I understand that this SQL statement will only return information if the criteria has been met. How can I still get the manager name whether or not the criteria has been met? Please help. Thanks.
 
Code:
Select Resource_Name,
       Resource_Manager_Name,
       sum(weekly_hours) as Weekly_Hours
from #Hours
group by resource_name, Resource_Manager_Name

Than add a condition to print the employee only if if the criteria you want to print is met, but print Manager always.


Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
What other condition aside from HAVING can I use to get the manager name?
 
None, if you want to filter only these records that have weekly_hours = 0.
What you have in Resource_Name?

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top