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)
 Eff Date issue

Author  Topic 

trsisko
Starting Member

2 Posts

Posted - 2008-09-20 : 19:17:23
I have the following query. I have a problem with this and need help. I am trying to ensure that only the entries with max effdate is shown from the membercontributionrates table. Problem is it doesnt appear to work. Please help


select *
from person m
join employee a on a.personuid = m.personuid
join schememember b on a.employeeuid = b.employeeuid
join memberbenefit c on b.memberuid = c.memberuid
join benefit d on c.benefituid = d.benefituid
join membercontributionrates e on a.employeeuid = e.parentuid
inner join (
select parentuid, max(Effdate) Effdate
from membercontributionrates
group by parentuid) addstripped
on e.parentuid = addstripped.parentuid
where m.nationalIDnumber = ''
and e.rate <> .00

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-21 : 01:38:48
quote:
Originally posted by trsisko

I have the following query. I have a problem with this and need help. I am trying to ensure that only the entries with max effdate is shown from the membercontributionrates table. Problem is it doesnt appear to work. Please help


select *
from person m
join employee a on a.personuid = m.personuid
join schememember b on a.employeeuid = b.employeeuid
join memberbenefit c on b.memberuid = c.memberuid
join benefit d on c.benefituid = d.benefituid
join membercontributionrates e on a.employeeuid = e.parentuid
inner join (
select parentuid, max(Effdate) Effdate
from membercontributionrates
group by parentuid) addstripped
on e.parentuid = addstripped.parentuid
and e.Effdate = addstripped.Effdate
where m.nationalIDnumber = ''
and e.rate <> .00



modify like above
Go to Top of Page
   

- Advertisement -