Yea, I just tried yours because it was shorter but didn't work :) Dan Goldberg
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Lena Dammstrom Sent: Thursday, October 09, 2014 10:49 AM To: RBASE-L Mailing List Subject: [RBASE-L] - RE: Getting the most recent row based on dates Bill's example is better than mine. My brain missed the MAX() part of the query! -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Dan Goldberg Sent: Thursday, October 09, 2014 12:42 PM To: RBASE-L Mailing List Subject: [RBASE-L] - RE: Getting the most recent row based on dates Thanks Lena and Bill. I will give it a try! Dan Goldberg -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Lena Dammstrom Sent: Thursday, October 09, 2014 10:37 AM To: RBASE-L Mailing List Subject: [RBASE-L] - RE: Getting the most recent row based on dates Select id into vid indicator from pvpn where partnumber = .vpartnumber and max(effdate) < .dateeff -----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

