sqlserverÊý¾Ý¼Ó×ÜÅÅÐòµÄÓï¾äÔõôд£¿
sqlserverÊý¾Ý¼Ó×ÜÅÅÐòµÄÓï¾äÔõôд£¿
ÈçÏÂÊý¾Ý±ítable
id
a
a
a
b
b
c
ÎÒÒªµÃµ½µÄΪ£º
a 3
b 2
c 1
ÕâÑù¼Ó×ÜidÃû³ÆÒ»ÑùµÄ²¢½øÐÐÅÅÐòÓ¦¸ÃÔõôд£¿
SQL code:
select id,count(1) from tb group by id
SQL code:
SELECT *,(SELECT COUNT(1) from TB WHERE ID=T.ID)AS NUM
from TB T ORDER BY
(SELECT COUNT(1) from TB WHERE ID=T.ID) DESC
SQL code:
select id,count(1) as px from tb order by px desc
ÕâÑù£¿»¹ÊÇÇɺϣ¿
SQL code:
select id,count(1) from tb group by id ORDER BY 2 DESC
SQL code:
select id,count(1) as px from tb order by count(1) desc
SQL code:
---²âÊÔÊý¾Ý---
if object_id('[tb]') is not null drop table [tb]
go
create table [tb]([id] varchar(1))
insert [t
Ïà¹ØÎÊ´ð£º
ÓÐÈËÊÔ¹ýÔÚwin7ÉÏ°²×°sqlserverÂð£¿
Ìý˵sql2000×°²»ÉÏÈ¥£¬²»ÖªµÀÆäËû°æ±¾Ðв»ÐС£
ºÃÏñ²»ÐÐ,²»¼æÈÝ,ÉÏ´ÎÒ²ÓÐÈËÎʹýѽ
ºÇºÇ£¬ÓÐÍøÓÑÓÐÏà¹ØµÄ¾ÑéÂð£¿
Õâ¸ösqlserverÒª¾¡Á¿×°ÔÚwin7ÉÏ¡£
SQLSERVER 2000Ã ......
ÎÒÏë°ÑmysqlÀïµÄusers±íÀïÊý¾Ýµ¼Èëµ½sqlserverÀïµÄfs_me_users±íÀï
ÀïÃæµÄ×ֶξͲ»ÁгöÀ´ÁË ÊǶÔÓ¦µÃ¡£
ÓÃasp asp.net »òÕß Ö±½ÓsqlÓï¾ä¶¼ÐÐ
Çë½Ì¸÷λ¡£¡£¡£¡££¡
Õâ¸ö²»ÄÑ°É
1. asp.net µÄ»°,¶ÁÈ¡mysqlµÄ¼Ç¼¼¯ ......
ÈçºÎ½«SqlServerÊý¾Ý¿âÖеÄÊý¾Ýµ¼Èëµ½ExcelÖУ¿
Ñ¡ÔñÊý¾Ý¿â£¬µã»÷ÓÒ¼ü ÈÎÎñ->µ¼³öÊý¾Ý Ö®ºó°´ÕÕÌáʾµ¼³ö¾Í¿ÉÒÔÁË£¡
±í¶àµÄ»° ÓÃÂ¥Éϵķ½·¨ ±È½Ï·½±ã ¿ÉÒÔ°ÑÊý¾Ý¿âÀïÏàÓ¦µÄ±íµ¼³ö »òÕßÈç¹ûÄãÊDzéѯ³öÀ´µÄ ......
ÒÔÏ´úÂëÊÇÌí¼ÓÊý¾Ý°´Å¥µÄ´úÂ룬Ïë°Ñtestid£¬ºÍtestnameÁ½¸ötxt´«µÝµ½Êý¾Ý¿âÖÐ
Êý¾Ý¿âÁ¬½Ó¿Ï¶¨Ã»ÎÊÌâ
¾ÍÊǺìÉ«²¿·ÖÀϱ¨´í
²»ÖªµÀΪʲô-£¬-
Çë¸÷λ¸ßÈË°ïæ¿´¿´£¡
лл£¡
Java code:
private void new ......
1.Ôõô°ÑÊý¾Ý´ÓsqlserverÀïÃæµÄÊý¾ÝдÈëµ½Ö¸¶¨Â·¾¶µÄexcel
±ÈÈç
declare @¹«Ë¾Ãû³Æ char(50)
set @¹«Ë¾Ãû³Æ = (select ¹«Ë¾Ãû³Æ from ¹«Ë¾ÐÅÏ¢)
EXEC [master]..xp_cmdshell 'bcp "select * from [master]. ......