mysql不支持top 支持limit

注:原创作品,分享以供交流学习,转载请注明出处。


    今天偶尔发现mysql居然不支持top语句,之前用hibernate记得用过top语句。原因是:mysql的确是不支持top语句,之前用的是hql语句,是hibernate帮你翻译成mysql支持的语句的。
通常hibernate的用法:   select top 5 id,name,password from user order by  id;
mysql中的用法: select id,content from notice order by id desc limit 5;

猜你喜欢

转载自supanccy2013.iteye.com/blog/2059281
今日推荐