By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,558 Members | 1,399 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,558 IT Pros & Developers. It's quick & easy.

Selecting records by date - need a little help

P: n/a
CK
Good Morning,
I have a view that contains rate information, contractIDs, and effective
dates.
I need to select the rate info based on contractID and date.
I can provide a date and contractID, and I need to select the rate info for
that contract where the effective date is <= dateprovided.

I need the 1 record that is closest to that date.

I am thinking something with max() perhaps. Any ideas? The <= effective
date will return several rows, I just need the one closest to the date I
provide.

Thanks for any advice,
CK
Mar 15 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
select top 1 * from xyz where date<=dateprovided order by dateprovided

Mar 15 '06 #2

P: n/a
CK
Cool. I think that'll do it. I appreciate your help.

"Doug" <dr*********@hotmail.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
select top 1 * from xyz where date<=dateprovided order by dateprovided

Mar 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.