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.
Author |
Topic |
mjimenezh
Yak Posting Veteran
81 Posts |
Posted - 2014-03-24 : 00:44:59
|
Hi, I have a SQL 2008 View that gives me the xrate of some date, I need that only shows me the xrate of most recent date How can I do this? here is my codeSELECT TOP (100) PERCENT MAX(date_l) AS Date_l, rate_exchange AS XRateFROM dbo.ratesGROUP BY date_l, rate_exchangeORDER BY date_l DESC Thanks in advance |
|
Monib
Starting Member
11 Posts |
Posted - 2014-03-24 : 02:18:35
|
Hi, I guess you are already taking maximum date from Date_1, If you want it from XRate, put Max funtion with that column and remove from group by. Stay BlessedMonib |
|
|
mjimenezh
Yak Posting Veteran
81 Posts |
Posted - 2014-03-24 : 02:23:40
|
Hi Monib, I was thinking that too but when I Execute it I'm receiving all the records not just the max date and I don't know why.Thanks... |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2014-03-28 : 06:35:11
|
Create your view with the following codeSELECT MAX(date_l) AS Date_l, rate_exchange AS XRateFROM dbo.ratesGROUP BY rate_exchange and do the ORDER BY when you query that viewMadhivananFailing to plan is Planning to fail |
|
|
mjimenezh
Yak Posting Veteran
81 Posts |
Posted - 2014-03-28 : 15:04:47
|
Thank you so much Mandhivanan |
|
|
|
|
|