Re: COMBINE DATA IN SINGLE ROW FROM SINGLE TABLE



Tom,

How can i Join this 2 table ? I am getting an error my LEFT OUTER JOIN
DOESNT WORK thanks

SELECT EmployeeNo, Datehired, SectionCode,
Department,Lastname,Firstname
FROM (dbo.Employees H1
GROUP By EmployeeNo, Datehired, SectionCode,
Department,Lastname,Firstname)
dbo.Employees LEFT OUTER JOIN ON dbo.empBenefits.EmployeeNo =
dbo.Employees.EmployeeNo

SELECT EmployeeNo, StartDate,Amount AS OLDBENEFITS,
EndDate,BenefitCode,
(SELECT MAX([amount])
FROM EMPBENEFITS T2
WHERE T2.employeeno = T.employeeno AND
startdate >= '2000-01-01' AND startdate <= '2007-03-30')
AS NEWBENEFITS
FROM dbo.empBenefits T
WHERE(StartDate =(SELECT TOP 1 ([startdate])
FROM EMPBENEFITS T1
WHERE T1.employeeno = T.employeeno AND
Benefitcode = 'HON' AND startdate >= '2000-01-01' AND startdate <=
'2007-03-30'))
GROUP BY EmployeeNo, Amount, BenefitCode, StartDate, EndDate, Amount

.



Relevant Pages

  • Re: COMBINE DATA IN SINGLE ROW FROM SINGLE TABLE
    ... working query, probably starting with SELECT and at least with its own FROM ... employees below a certain number, for example, to get it down to 2 ... I am getting an error my LEFT OUTER JOIN ... FROM EMPBENEFITS T2 ...
    (microsoft.public.access.queries)
  • Re: Doing multiple joins on one table
    ... it doesnt work, it returns always the same max countfor all the rows ... CREATE TABLE GameYellows( ... LEFT OUTER JOIN GameYellow AS y ON y.Player_ID = p.id ...
    (microsoft.public.sqlserver.mseq)