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)
 Date Problem

Author  Topic 

ukro
Starting Member

2 Posts

Posted - 2009-06-07 : 09:44:46
In my currency exchange table, the entries are not done on a daily bases as all the rate dont change. Can any one give me a qurey which gives me the rate on a perticular day and if that day is not there then it should give me the rate for previous day.

Will be thankfull to all the hlp i can get.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-07 : 09:55:20
[code]
select top 1 *
from [currency exchange]
where date <= @date
order by date desc
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

ukro
Starting Member

2 Posts

Posted - 2009-06-07 : 10:49:55
Thanks, it works
Go to Top of Page
   

- Advertisement -