sql code
Õâsql Óï¾äдµÄÕæµÄºÜ²»´í!
if object_id('[tb]') is not null drop table [tb]
go
create table [tb]([col1] bigint,[col2] varchar(6),[col3] varchar(6))
insert [tb]
select 130126200201000275,'ÍõÎÄϼ','½ù´¨´¨' union all
select 130126200201000275,'ÍõÎÄϼ','½ù澤' union all
select 130126200201000275,'ÍõÎÄϼ','aaaa' union all
select 130126200201000276,'ÖÜ書¶ð','³Ì˼³¬' union all
select 130126200201000276,'ÖÜ書¶ð','³Ìٮٮ' union all
select 130126200201000277,'風¾Õ','³ÌÇàÇà' union all
select 130126200201000277,'風¾Õ','³Ì¶þС' union all
select 130126200201000278,'張Ó¢ÌÒ','³Ì´ó慶' union all
select 130126200201000278,'張Ó¢ÌÒ','³ÌС»¨'
--------------¿ªÊ¼²éѯ--------------------------
select * from tb
select col2,col3 from
(
select col1,col2,col3 from [tb] t
where not exists(select * from tb where col1=t.col1 and col2=t.col2 and col3>t.col3)
union all
select col1,'',col3 from [tb] t
where exists(select 1 from tb where col1=t.col1 and col2=t.col2 and col3>t.col3)
)T
order by col1,col3 desc
Ïà¹ØÎĵµ£º
SQL ServerÊý¾Ý¿âÖвð·Ö×Ö·û´®º¯ÊýµÄ¾ßÌå·½·¨£º
ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
¡¡¡¡CREATE¡¡ FUNCTION uf_StrSplit '1.1.2.50','.'
¡¡¡¡(@origStr varchar(7000),¡¡ --´ý²ð·ÖµÄ×Ö·û´®
¡¡¡¡@markStr varchar(100))¡¡¡¡--²ð·Ö±ê¼Ç£¬Èç','
¡¡¡¡RETURNS @splittable table
¡¡¡¡(
¡¡ ¡¡str_id¡¡¡¡varchar(4000) NOT NULL, --±àºÅID ......
ÕÛÌÚÁËÎÒ°ëÌìÖÕÓڸ㶨ÁË
²Î¿¼ÁËÕâ¸öÎÄÕ£ºhttp://doc.javanb.com/hibernate-reference-3-2-0-zh/ch16.html
final static String querySql = "select {enterprise.*}, {dict.*} ,{balancd.*}, {weightinfo.*} "
+ "from weight_info weightinfo left outer join t_dict dict on {weightinf ......
Student(S#,Sname,Sage,Ssex) ѧÉú±í
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÎÊÌ⣺
1¡¢²éѯ“001”¿Î³Ì±È“002”¿Î³Ì³É¼¨¸ßµÄËùÓÐѧÉúµÄѧºÅ£»
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
fr ......
Vista³öÁËÃûµÄ¼æÈÝÐÔÎÊÌâ¶à£¬ºÜ¶àÈËÒ²¿àÓÚSQL SERVER²»Äܰ²×°ÔÚVistaÏ¡£ÏÖÔÚÎÒ½«×Ô¼ºµÄ°²×°¹ý³Ì˵Ï£º
²Ù×÷ϵͳ£ºWindows Vista Home Basic
´¦Àíµ¥Ôª£ºInter P8600 2.40GHz
Ö÷´æ´¢Æ÷£º2G
Íâ´æ´¢Æ÷£º250G
Èí¼þ×¼±¸£º£¨¶¼¿ÉÒÔÔÚ΢Èí¹Ù·½ÍøÕ¾ÕÒµ½£¬¾ùÃâ·Ñ£©
1.SQL SERVER 2005 EXPRESS£¨40.6M ......
¡¡Ò»¡¢±¸·ÝÊý¾Ý¿â
¡¡¡¡1¡¢´ò¿ªSQLÆóÒµ¹ÜÀíÆ÷£¬ÔÚ¿ØÖÆÌ¨¸ùĿ¼ÖÐÒÀ´Îµã¿ªMicrosoft SQL Server
¡¡¡¡2¡¢SQL Server×é-->Ë«»÷´ò¿ªÄãµÄ·þÎñÆ÷-->Ë«»÷´ò¿ªÊý¾Ý¿âĿ¼
¡¡¡¡3¡¢Ñ¡ÔñÄãµÄÊý¾Ý¿âÃû³Æ£¨ÈçÂÛ̳Êý¾Ý¿âForum£©-->È»ºóµãÉÏÃæ²Ëµ¥ÖеŤ¾ß-->Ñ¡Ôñ±¸·ÝÊý¾Ý¿â
¡¡¡¡4¡¢±¸·ÝÑ¡ÏîÑ¡ÔñÍêÈ«±¸·Ý£¬Ä¿µÄÖеı ......