¼òµ¥µÄsqlÎÊÌâ
ÐÕÃû ѧ¿Æ
a ÓïÎÄ
a Êýѧ
b Ó¢Óï
b ÕþÖÎ
ÎÒÏëµÃµ½ a ÓïÎÄ£¬Êýѧ
b Ó¢ÓÕþÖÎ
ÇëÎÊÔõôдsqlÓï¾ä
select * from table where 'ÐÕÃû'='a';
²»ÊÇÕâ¸ö ÎÒÕâÒªÏÔʾËùÓÐ ¶ø²»ÊǸù¾ÝÌõ¼þÀ´µÄ
ÐÐרÁеÄÎÊÌâ
http://blog.csdn.net/zhanyong168/archive/2009/01/08/3735969.aspx
²Î¿¼ÏÂÉÏÃæµÄ
ÏÔʾËùÓÐÊÇʲôÒâ˼°¡¡£select * from table¾ÍËùÓа¡¡£
ÐèÒªÓõ½ÐÐÁÐת»»ÁË¡£½¨Òé²Î¿¼²©¿Í£ºhttp://blog.csdn.net/chenjianyong94/archive/2009/05/06/4155420.aspx
¿´²»³ö¸ù¾Ýʲô¹æÂÉ
sql server °æ±¾ÇøÓÐÈËÎʹýÕâÑùµÄÎÊÌ⣬µ«ÊÇ´ð°¸Íü¼ÇÁË£¬ºÃÏñ²»ÊǺܸ´ÔÓ£¬ÄǸöÊÇÓÃ2005дµÄ
²éѯ³öÀ´°Ñ×Ö·û´®¼ÓÉÏ,
¶¥Ò»¸ö
лл´ó¼ÒµÄ»Ø´ð ²»¹ýÏ£ÍûÄܵõ½sql¶ø²»ÊÇÁ´½Ó
SQL code:
SELECT [ÐÕÃû],[ѧ¿Æ]=CAST([ѧ¿Æ] as nvarchar(100))
INTO #t from #test
ORDER BY [ÐÕÃû],[ѧ¿Æ]
DECLARE @col1 varchar,@col2 nvarchar(100)
UPDATE #t SET
@col2=CASE WHEN @col1=[ÐÕÃû] THEN @col2+','+[ѧ¿Æ] ELSE [ѧ¿Æ] END,
@col1=[ÐÕÃû],
[ѧ¿Æ]=@col2
SELECT [ÐÕÃû],[ѧ¿Æ]=MAX([ѧ¿Æ]) from #t GROUP BY [ÐÕÃû]
ÍüÁË˵ÁË£¬#test¾ÍÏ൱ÓÚÄãµÄ±í£¬Ã»Ð´½¨±íÓï¾ä
SQL c
Ïà¹ØÎÊ´ð£º
ÔÌû×Ó£ºhttp://topic.csdn.net/u/20090910/12/813a40a2-922d-4f6a-b30b-a16b9a608f81.html?seed=1336087098&r=59699368#r_59699368
ÏÂÃæµÄ´úÂëÓдíÎóÂð£¿sqlÓï¾äÔÚQueryÖÐÊÇ¿ÉÒÔÖ´Ðгö½á¹ûµÄ¡£
Set C ......
¸÷λ´óÏÀ£ºÇëÎÊÔõÑùÔÚASP³ÌÐòÖе÷ÓÃSQL´æ´¢¹ý³Ì£¿Ð»Ð»£¬Çë¸ø¸öÀý×Ó£¡
http://hi.baidu.com/lz0830/blog/item/e847e5e9077fde39b80e2db9.html
1 ÕâÒ²ÊÇ×î¼òµ¥µÄ·½·¨,Á½¸öÊäÈë²ÎÊý£¬ÎÞ·µ»ØÖµ£º
set con ......
×Ô´ÓÖ±½ÓÔÚÒ»¸ö±íÀï¼ÓÁ˸ö×ֶΣ¨nvarchar ÆäËûĬÈÏ£¬²»²åÈë×Ô¼ºÄ¬ÈÏΪ <null>£©ºó,ÖØÆôÍøÕ¾+sql server 2000 6-8¸öСʱºó³öÏÖÎÊÌ⣺ÍøվдÊý¾Ý¿âʱ½Å±¾³¬Ê±
Active Server Pages ´íÎó 'ASP 0113 ......
ÈçÌâ:Ç°¼¸Ìì·þÎñÆ÷»¹ÊÇºÃºÃµÄ ½ñÌìÍøÒ³´ò²»¿ªÍ»È»³öÏÖ´íÎó,Ò»²éÊÇÁ´½Ó²»ÉÏÊý¾Ý¿âÁË?
(²éѯ·ÖÎöÆ÷ºÍÆóÒµ¹ÜÀíÆ÷¶¼¿ÉÒÔÕý³£ÏÔʾ)
[SqlException (0x80131904): Óû§ 'sa' µÇ¼ʧ°Ü¡£]
......
´ó¼ÒºÃ£¬ÇëÎÊÔÚ±íMÖÐÓÐ×ֶΣºa b c d e
ÎÒÏë²é³öÆäÖÐÂú×ãÏÂÃæÈÎÒâÒ»ÏîµÄÊý¾Ý£¬1.×Ö¶Îa µÄÖµ²»ÊÇ ¡®Êé»ò±Ê»ò±¾¡¯ÖÐÈÎÒ»£¬2.aΪÊéµÄʱºò×Ö¶Îb,cÊÇ¿Õ;3.µ±aֵΪ±ÊµÄʱºòdÊÇ¿Õ;4.µ±aΪ±¾µÄʱºòb,d,e¶¼ÊÇ¿Õ;5.È ......