Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaÀàÖÐдsqlÓï¾ä£¬²éѯÌõ¼þ°üº¬»»ÐÐ

detachedCriteria.add(Restrictions.or(
       Restrictions.like("chengBanDanWeiIds", rForm.getChengBanDanWeiIds()+(char)13, MatchMode.START),
       Restrictions.or(
               Restrictions.like("chengBanDanWeiIds", rForm.getChengBanDanWeiIds()+ (char)13, MatchMode.END),
         Restrictions.eq("chengBanDanWeiIds", rForm.getChengBanDanWeiIds())
         )));
»»Ðв»ÓÃCHAR(13),ÓÃ(char)13


Ïà¹ØÎĵµ£º

·À·¶SQL×¢Èëʽ¹¥»÷

SQL×¢Èëʽ¹¥»÷ÊÇÀûÓÃÊÇÖ¸ÀûÓÃÉè¼ÆÉϵÄ©¶´£¬ÔÚÄ¿±ê·þÎñÆ÷ÉÏÔËÐÐSqlÃüÁîÒÔ¼°½øÐÐÆäËû·½Ê½µÄ¹¥»÷¶¯Ì¬Éú³ÉSqlÃüÁîʱûÓжÔÓû§ÊäÈëµÄÊý¾Ý½øÐÐÑéÖ¤ÊÇSql×¢Èë¹¥»÷µÃ³ÑµÄÖ÷ÒªÔ­Òò¡£
±ÈÈ磺
Èç¹ûÄãµÄ²éѯÓï¾äÊÇselect * from admin where username="&user&" and password="&pwd&""
 ÄÇô£¬Èç¹ûÎÒµÄÓû§ÃûÊ ......

SQLº¯ÊýÖ®ÆäËûº¯Êý

MySQLÖÐÎIJο¼ÊÖ²á- 7 MySQL ÓïÑԲο¼
<!--
body { font-size: 9pt; }
a:hover{color:red;}
a.t1:visited{color:red;}
-->
DATABASE()

·µ»Øµ±Ç°µÄÊý¾Ý¿âÃû×Ö¡£
mysql> select DATABASE();
-> 'test'
Èç¹ûûÓе±Ç°µÄÊý¾Ý¿â£¬DATABASE()
·µ»Ø¿Õ×Ö·û´®¡£
USER()

¡¡
SYSTEM_USER() ......

sql·ÖÒ³Á½·½°¸

±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º
SELECT TOP Ò³¼Ç¼ÊýÁ¿ *
from ±íÃû
WHERE (ID NOT IN
  (SELECT TOP (ÿҳÐÐÊý*(Ò³Êý-1)) ID
  from ±íÃû
  ORDER BY ID))
  ORDER BY ID
//×Ô¼º»¹¿ÉÒÔ¼ÓÉÏһЩ²éѯÌõ¼þ
Àý:
sele ......

SQL server 2005»ùÓÚÒÑ´æÔÚµÄ±í´´½¨·ÖÇø


< type="text/javascript">
< type="text/javascript">
ÈçתÔØ£¬Çë×¢Ã÷³ö´¦£ºhttp://blog.csdn.net/robinson_0612/archive/2009/11/07/4783702.aspx

     
Ëæ×ŵ±½ñÊý¾Ý¿âµÄÈÝÁ¿Ô½À´Ô½¿ìµÄ³¯×ÅÔÚ´óÐÍÊý¾Ý¿â»ò³¬´óÐÍÊý¾Ý¿âµÄ·¢Õ¹£¬¶ÔÓÚÊý¾Ý¿âÖеĴóÐͱíÒÔ¼°¾ßÓи÷ÖÖ·ÃÎÊģʽµÄ±íµÄ¿ÉÉìËõÐ ......

SQL exists ºÍin

in ºÍ existsÆäʵͦºÃÇø±ðµÄ.ÇÒ¿´Ï±߻ù±¾¸ÅÄî¡£
in ÊÇÒ»¸ö¼¯ºÏÔËËã·û.
a in {a,c,d,s,d....}
Õâ¸öÔËËãÖÐ,Ç°ÃæÊÇÒ»¸öÔªËØ,ºóÃæÊÇÒ»¸ö¼¯ºÏ,¼¯ºÏÖеÄÔªËØÀàÐÍÊǺÍÇ°ÃæµÄÔªËØÒ»ÑùµÄ¡£ÊµÏֵĶԼ¯ºÏÖеÄÔªËؽøÐбéÀú£¬ÒÔÈ·¶¨¸ø¶¨µÄÔªËØaÊÇ·ñÓë×Ó²éѯ»òÁбíÖеÄÖµÏàÆ¥Åä¡£
in ÔËËãÓÃÔÚsqlÓï¾äÖÐ,ËüºóÃæ´øµÄselect Ò»¶¨ÊÇÑ¡Ò»¸ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ