Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 left join help??

Author  Topic 

krish001
Yak Posting Veteran

61 Posts

Posted - 2009-11-03 : 14:21:20
SELECT TP.[Task BU],TP. [Master Audit Type],
dbo.FN_PLAN_4_YEAR_AUDIT_COMPLETION(TP.[Task BU],TP. [Master Audit Type],'',@FromDate,@ToDate)as PlanForYear,
dbo.FN_COMPLETED(MP.BU,MP.[Audit Type],'',@FromDate,@ToDate)as Completed

FROM MSP_EPMPROJECT_USERVIEW MP,MSP_EPMTASK_USERVIEW TP where TP.[Task BU] is not null
group by [Task BU],[Master Audit Type]


now the issue is iam using MP.BU and MP.Auditype how can i join these two with MSP_EPMTASK_USERVIEW TP

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-11-03 : 14:43:38
what fields do you want to join them on?


SELECT TP.[Task BU],TP. [Master Audit Type],
dbo.FN_PLAN_4_YEAR_AUDIT_COMPLETION(TP.[Task BU],TP. [Master Audit Type],'',@FromDate,@ToDate)as PlanForYear,
dbo.FN_COMPLETED(MP.BU,MP.[Audit Type],'',@FromDate,@ToDate)as Completed
FROM MSP_EPMPROJECT_USERVIEW MP
LEFT JOIN MSP_EPMTASK_USERVIEW TP
ON MP.BU = TP.[Task BU]
where TP.[Task BU] is not null
group by [Task BU],[Master Audit Type]


<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion
Go to Top of Page

krish001
Yak Posting Veteran

61 Posts

Posted - 2009-11-03 : 15:19:39
quote:
Originally posted by yosiasz

what fields do you want to join them on?


SELECT TP.[Task BU],TP. [Master Audit Type],
dbo.FN_PLAN_4_YEAR_AUDIT_COMPLETION(TP.[Task BU],TP. [Master Audit Type],'',@FromDate,@ToDate)as PlanForYear,
dbo.FN_COMPLETED(MP.BU,MP.[Audit Type],'',@FromDate,@ToDate)as Completed
FROM MSP_EPMPROJECT_USERVIEW MP
LEFT JOIN MSP_EPMTASK_USERVIEW TP
ON MP.BU = TP.[Task BU]
where TP.[Task BU] is not null
group by [Task BU],[Master Audit Type]


<><><><><><><><><><><><><><><><><><><><><><><><><>
If you don't have the passion to help people, you have no passion




iam gettin a error MP.BU,MP.[Audit type] are not in select list or group by
Go to Top of Page
   

- Advertisement -