🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.database
Article #379

Re: ��������һ��SQL����ִ��˳��

#379
From: �������yoursunny.com
Date: Mon, 16 Mar 2009 13:10
34 lines
2150 bytes
Transact-SQL �ο�  SELECT �Ӿ�


TOP n [PERCENT]

ָ��ֻ�Ӳ�ѯ��������ǰ n �С�n �ǽ��� 0 �� 4294967295 ֮����������
ָ���� PERCENT����ֻ�ӽ�������ǰ�ٷ�֮ n �С���ָ��ʱ�� PERCENT ʱ��n ��
���ǽ��� 0 �� 100 ֮�������

����ѯ�� ORDER BY �Ӿ䣬������� ORDER BY �Ӿ������ǰ n �У���ǰ�ٷ�֮ 
n �У�������ѯû�� ORDER BY �Ӿ䣬�е�˳�����⡣




TOP��SQL SERVER��д������Ȼ����ORDER BY��TOP����
MySQL��LIMIT��Ҳ����ORDER BY��LIMIT��


���ǣ�
SELECT COUNT(*) FROM table_name LIMIT 10
����д����󷵻�10��Ҳ������LIMIT��COUNT��
�� �� haorenzk ( ����) ��
�������ᵽ: ��: SELECT top 6 : num,usersname,fplace : FROM usermain
: WHERE fgroupno=1
: ORDER BY fplace
: �����ʵ��ǣ��˾��Dz�����ORDER BY�ź���֮����ѡ��ǰ6��������select��order by


--
�������ѧϰƵ�� http://study.yoursunny.com
������⼼��Ƶ�� http://www.65536.cn

�� ��Դ:����ˮ˼Դ bbs.sjtu.edu.cn��[FROM: 219.228.103.11]
Technical Details
Message-ID: <4f36jL$bGa@bbs.sjtu.edu.cn>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!feeder.erje.net!news.byr.edu.cn!news.shec6.edu.cn!SJTU

Show Full Headers
Complete Article Headers
X-Google-Thread: 101948,b22b2f5ef9a6d430
X-Google-Attributes: gid101948,domainid0,public,usenet
X-Google-Language: Chinese,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!news.glorb.com!news2.glorb.com!feeder.erje.net!news.byr.edu.cn!news.shec6.edu.cn!SJTU
From: yoursunny.bbs@bbs.sjtu.edu.cn (�������yoursunny.com)
Newsgroups: cn.bbs.comp.database
Subject: Re: ��������һ��SQL����ִ��˳��
Date: 16 Mar 2009 13:10:26 GMT
Organization: ��ˮ˼Դ
Message-ID: <4f36jL$bGa@bbs.sjtu.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: database/M.1237208709.A