penghui233 2006-12-2 11:00
这个SQL语句怎么写,请各位前辈帮一下
一张表格里面有,表名是money.关于银行里面的货币兑换,表里面有from, to ,date ,values字段。现在要用SQL语句查询[b][color=red]最近[/color][/b]的各种货币兑换数据。数据每一天都有可能不同,在不断的更换。比如
from to date values
rmb meiyuan 1/1/2000 0.8
fuc rmb 1/1/2000 1.66
rmb miyuan 1/2/2000 0.78
fuc rmb 1/2/2000 1.59
[color=magenta](兑换数据每一天可能不一样的。说明:date不是保存最新的日期,保存的只是更新日期)[/color]
[[i] 本帖最后由 penghui233 于 2006-12-2 18:17 编辑 [/i]]
guoyubill 2006-12-2 12:59
没明白说的什么意思。关键字是那个?
penghui233 2006-12-2 18:10
没有什么关键字。
423799223 2006-12-12 17:32
主键吧
bossy 2007-11-11 20:00
我认为只要按一个时段来进行查询就可以吧.或者按时间来进行排序一下也行.
yuxuan555269 2007-11-28 11:00
不是很明白
chm_1223 2007-12-25 16:56
同意5楼:lol
hgl 2008-1-27 20:31
select top 1 *from money order by date desc
puchonghui 2008-1-28 12:20
select * from money as m where date in(select top 1 date from money where m.from=from and m.to=to order by date)
lgh1999 2008-2-25 19:24
select * from money ordey by date desc
lvguobin 2008-4-28 10:19
I don't know what are talking about .
dongchanglin 2008-6-11 11:54
select c.* from money c (select t.from,t.to,max(date) date from money t group by t.from ,t.to) a where c.from=a.from and c.to=a.to and c.date=a.date
SQL没优化,但执行没问题