各位高手们,我现在想问一个问题,在我的数据库中有一张用与存放图书入库的表,里面的字段有图书入库时间(book_in_date),入库数量(book_in_num),还有入库价格(book_in_price)等,现在就是说我如果想要得知各种图书的最近进货价是多少,这个要怎么实现呢?
解决方案 »
- sqlserver 自增列ID最大值是多少?如果达到最大值,系统将如何处理?
- select * frome tablename where time between 的问题
- 一个存储过程问题,有关于缓存表的。
- SQLSERVER中有没有设置闲置时间的地方
- 简单的sql问题
- [在线等]请教一个多表查询语句 关键字:INNER JOIN, SUM, GROUP BY
- sqlserver2008 inset出错:无法打开与 SQL Server 的连接 [53]. 求高手解答
- SQL Server 2005 企业版 32X慢,如何提速?
- 请问哪有win2000下载,请不吝告之
- 顾客最喜欢买哪类商品,这条SQL语句如何写呢?
- SQL的老鸟,帮我看看这个问题怎么解决
- BCP问题
where not exists (select 1 from tablename where id = t1.id and book_in_date > t1.book_in_date)
select a.book_id , b.book_in_date , a.book_in_price as 最近进货价 from TB a,
(select book_id , max(book_in_date) as book_in_date from TB group by book_id) b
where a.book_id = b.book_id and a.book_in_date = b.book_in_date
from book
where (getdate()-book_in_date)<=天数
group by bookid
你这样做!
select book_in_price
from 表
where book_in_price=(select max(book_in_price) from 表)
应该可以实现您所说的!