ÇóÒ»sqlÓï¾ä - MS-SQL Server / »ù´¡Àà
±í
id bh
1 10
2 11
3 12
4 15
5 16
6 22
7 25
8 26
9 27
10 28
½«bh°´Á¬Ðø·Ö¶Î³öÀ´·µ»Ø×Ö·û´®£º
10~12£¬15~16£¬22£¬25~28
SQL code:
declare @t table(num int)
insert into @t select 1
union all select 2
union all select 3
union all select 4
union all select 5
union all select 12
union all select 17
union all select 18
union all select 19
union all select 20
union all select 25
select
rtrim(a.num)+(case when min(b.num)!=a.num then '-'+rtrim(min(b.num)) else '' end)
from
(select t.num from @t t where not exists(select 1 from @t where num=t.num-1)) a,
(select t.num from @t t where not exists(select 1 from @t where num=t.num+1)) b
where
a.num<=b.num
group by a.num
-------------------------
1-5
12
17-20
25
*/
{{
Ïà¹ØÎÊ´ð£º
ÎÒÓжà¸ö±íA B C ½á¹¹ÊÇÒ»ÑùµÄ£¬¶¼ÓÐ2¸ö×Ö¶ÎnameºÍcontent,ÎÒÒªËÑË÷ËùÒÔ±íËùÓÐ×Ö¶ÎÖаüº¬¡°Öйú¡±µÄÄÚÈÝ Õâ¸öSQLÓï¾äÔõôд
ÈçºÎ½«¶à¸ö±íµÄ²éѯ½á¹ûÁ¬³ÉÒ»¸ö±í Õâ¸öSQLÓï¾äÔõôд ±íµÄ½á¹¹ÊÇÒ»ÑùµÄ
ÀýÈç£ ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
sqlÎÒÏëµÃµ½Ò»×Ö·û´®Îª:
sldkf|||sdeww
erkv|||rltdk
jemcl|||ligf
¾ÍÊÇ|||ºóÃæµÄ×Ö·ûÓÐʲôº¯ÊýÄܵõ½Âð£¿ÊÇÔÚsqlÓï¾äдµÄ£¬²»ÊÇÔÚÒ³ÃæдµÄ£¬ÄÇλ¸ßÊÖÀ´Ö¸½ÌÏ£¬ÐÂÊÖ£¬Ð»Ð»
ÔνñÌì²»ÊÇдÁËô
select parsen ......
СµÜ£¬×î½üҪתÐÐÈ¥×öoracle¿ª·¢ÁË£¬ÓÉÓÚ´óѧ±Ïҵʱ£¬×ßÁ˸öÍä·£¬ÏÖÔÚºÜСÐÄ£¬ÎÊÏ£¬×öPL/SQLÓÐûÓÐǰ;£¿£¿£¿
µ±È»ÎÒ˵µÄÕâ¸öǰ;ÊÇÖ¸ ÒÔºóÒªÌø²Û£¬Êг¡¶ÔÕâÑùµÄÈ˲ŵÄÐèÇóÁ¿´ó²»´ó£¿£¿
3q ÄÇ¿´À´»¹Ö»ÄÜÏȽӴ ......