June 26, 2008 at 3:52 pm
select #temp1.*,#temp2.*
FROM #temp2 left outer join #temp1 on #temp1.EmployeeID=#temp2.EmpID
How can i do a group by EmpId here.
June 26, 2008 at 4:08 pm
Start with this:
select
rightt.*,
leftt.*
FROM
#temp2 leftt
left outer join #temp1 rightt
on rightt.EmployeeID = leftt.EmpID
GROUP BY
leftt.EmpID
Some changes I'd make would be to explicitly identify the columns being returned. Also, are you aggregating any of the fields?
😎
June 26, 2008 at 4:16 pm
NO, tht will not do.
it gives error for many columns
Column '#temp2.EmpIDis invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
June 26, 2008 at 4:22 pm
A GROUP BY assumes you are aggregating some data in your select statement. That was the question I also asked in my previous post.
Now my question is, what are you trying to accomplish with this query?
😎
June 26, 2008 at 4:27 pm
both temp tables already has some aggregated values in that, now am trying to group them by empid.
June 26, 2008 at 4:33 pm
I am going to need more to help you out. Please read this article, it will show you how to help up help you:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
😎
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply