Try this.
select top 1 id into vID from pvpn where partnumber = .vpartnumber and effdate < .dateeff order by effdate desc Dennis McGrath -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Dan Goldberg Sent: Thursday, October 09, 2014 12:27 PM To: RBASE-L Mailing List Subject: [RBASE-L] - Getting the most recent row based on dates This for some reason is not working for me and I am having a mind block. What I want to get the id of a row that is the most recent that is less than vdateeff I tried: Set var vid= id in pvpn where partnumber = .vpartnumber and max(effdate) < .dateeff It gives me an error "illegal select function" I am probably missing something stupid. Anybody have any idea on what I am doing wrong? TIA Dan Goldberg

