SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Report Group
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

cheatasp
Starting Member

Cambodia
10 Posts

Posted - 05/19/2009 :  01:58:28  Show Profile  Visit cheatasp's Homepage  Send cheatasp a Yahoo! Message  Reply with Quote
Dear All,

I have found problem with report that has group section

Below query is the group

declare @Department varchar(4)
declare @JobType varchar(4)

set @Department ='%'
set @JobType='%'



SELECT DISTINCT T.JobTypeID, T.JobType
FROM TAB_JobPositionType AS T
INNER JOIN TAB_JobPosition AS J ON J.JobTypeID = T.JobTypeID
INNER JOIN TAB_Employee AS E ON J.EmpID = E.EmpID
INNER JOIN TAB_Department AS D ON E.DepartmentID = D.DepartmentID
INNER JOIN TAB_Location AS L ON E.LocationID = L.LocationID
WHERE datediff(dd,PromotionDate,getdate())>=75
AND datediff(dd,PromotionDate,getdate())<=90
AND J.JobTypeID LIKE @JobType
AND E.ContractTypeID=1
AND D.DepartmentID LIKE @Department


And below is the detail

declare @Department varchar(4)
declare @JobType varchar(4)

set @Department ='%'
set @JobType='%'


SELECT DISTINCT E. EmpID,Name, PromotionDate
,dateadd(day,90-datediff(dd,PromotionDate,getdate()),getdate()) As EndProbation
,(90-datediff(dd,PromotionDate,getdate())) AS DayLeft, D.Department, L.Location
FROM TAB_Employee AS E
INNER JOIN TAB_JobPosition AS J
ON J.EmpID = E.EmpID
INNER JOIN TAB_Department AS D ON E.DepartmentID = D.DepartmentID
INNER JOIN TAB_Location AS L ON E.LocationID = L.LocationID
WHERE datediff(dd,PromotionDate,getdate())>=75
AND datediff(dd,PromotionDate,getdate())<=90
AND JobTypeID LIKE @JobType
AND E.ContractTypeID=1
AND D.DepartmentID LIKE @Department


But when I run report it show differnce group but the same detail


please help me

khtan
In (Som, Ni, Yak)

Singapore
17635 Posts

Posted - 05/19/2009 :  02:05:49  Show Profile  Reply with Quote
check your INNER JOIN. Make sure you specify all the columns in the foreign key in the ON


KH
Time is always against us

Go to Top of Page

cheatasp
Starting Member

Cambodia
10 Posts

Posted - 05/19/2009 :  02:29:26  Show Profile  Visit cheatasp's Homepage  Send cheatasp a Yahoo! Message  Reply with Quote
Dear,

In table detail has foreign key JobTypeID and table main has primary key JobTypeID .
I inner join them already
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000