易截截图软件、单文件、免安装、纯绿色、仅160KB

请教:SQL语句

有如下几条记录,记录同一个商品由不同供应商在不同时期的进货价格,DATE字段代表的是进货价格起始日:

table结构如下:
date price vendor
20100101 10.00 A
20100321 12.00 A
20100425 9.00 A
20100209 10.00 B

今天是4月2日,我如何能取到目前各个供应商的进货价格呢?
20100209 10.00 B
20100321 12.00 A

谢谢各位啦~~
select * from table a,(select max(date),vendor group by vendor) b
where a.date=b.date and a.vendor=b.vendor



select * from table a
where not exists (select 1 from table b where a.v=b.v and a.d<b.d)


楼上的貌似都可以··

引用
楼上的貌似都可以··


也谢谢codearts。结贴时分已经送完了~~~~




相关问答:

csv文件转换成sql导入到数据库,没有数据为何?

执行的顺序:
1)文件浏览框(选择文件使用)
选择好文件后
点击一个导入按钮的时候 ,把上面上传框里的csv文件以一个ID为文件名,上传到**/**文件夹下
2)读取这个文件夹下的csv的文件,转换成sql
3 ......

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

Asp+sql server问题 - Web 开发 / ASP

我一个项目,有个插入操作,具体是这样的:
我有进货信息表。在出货时选择相应的进货信息,输入数量,选择部门后,点保存按钮,由于网络延时,点一下没有反映,于是用户就又点一下,导致一次插入了两条记录:
例: ......

ASP链接SQL的简单登陆界面 - .NET技术 / ASP.NET

protected void btnLogin_Click(object sender, EventArgs e)
  {
  SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号