日期:2014-05-16  浏览次数:20812 次

求助?如何用MYSQL写个只选取前两条记录的语句?
用MSSQL 是这么写的,
例如:select top 2 ID,GoodsName,price,nowprice,picture from tb_goods where sale=1 order by INTime desc

但是用MYSQL怎么写呢?还有个问题MYSQL里有没有类似MSSQL里的money类型?
谢谢大侠们!!!

------解决方案--------------------

select top 2 ID,GoodsName,price,nowprice,picture from tb_goods where sale=1 order by INTime desc 
==〉
SQL code

select ID,GoodsName,price,nowprice,picture   from   tb_goods   where   sale=1   order   by   INTime   desc limit 2;

MONEY类型在MYSQL中可以用两步:
1、用DECIMAL类型,
2、用FORMAT函数显示。

比如
select format(2000000.5222,3);

------解决方案--------------------
支持ls:
----------
select ID,GoodsName,price,nowprice,picture from tb_goods where sale=1 order by INTime desc limit 2;