|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Can someone help me combine these 3 queries into one query. I'm using SQL Server 2000. The queries work under Enterprise Manager but I'm just not sure how to get it to work. Thanks, drop table #tmpded drop table #tmpytd Select Employee, Code, Amount into #tmpded from EMPayrollWithholdingDetail where Employee = @emp AND Period = @per AND PostSeq = @seq Select Employee, Code, Sum(Amount) as AmountYTD into #tmpytd from EMPayrollWithHoldingDetail Where Employee = @emp Group by Employee, Code Select a.Employee, a.Code, a.AmountYTD, b.Amount from #tmpytd a left join #tmpded b on a.Employee = b.Employee Where a.Code = b.Code Thanks, kw |
|
#2
|
|||
|
|||
|
Create a stored procedure. It will allow you to execute all these queries together, but independent of each other, in one shot.
S- |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Combine 3 queries into 1 query |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|