¹ßÃé : http://www.phpschool.com
#############################################################
Áú¹® :
°Ë»öÀº select * from table¸í where column¸í like '%°Ë»ö¾î%'; ÀÌ·¸°Ô ÇÏÀݾƿä?
±Ùµ¥ ¿©±â¼ %ÀÇ ÀÇ¹Ì¿Í _ÀÇ Àǹ̵µ ¾Ë°í ÀÖ½À´Ï´Ù. ÁÖ¼Ò °Ë»ö¿¡¼ ±Ã±ÝÇÑ Á¡ÀÔ´Ï´Ù. Á¦°¡ ¸¸µç ¿ìÆí¹øÈ£ ÁÖ¼Ò °Ë»ö¿¡¼´Â "½Åµ¿"À̶ó´Â ´Ü¾î¸¦ Ä¡¸é ¾öû³ª°Ô ¸¹Àº data°¡ ³ª¿É´Ï´Ù. ±×·±µ¥ iloveschool¿¡ °¡¼ Çغ¸¸é ±×·¸°Ô ¸¹ÀÌ ³ª¿ÀÁö°¡ ¾Ê¾Æ¿ä.. ÀÌÀ¯¸¦ »ìÆìºÃ´õ´Ï iloveschoolÀº ½Åµ¿À» Ä¡¸é "½Åµ¿" ȤÀº "½Åµ¿¸é" ȤÀº "½Åµ¿À¾"ÀÌ µé¾îÀÖ´Â data´Â °Ë»öµÇ´Âµ¥ ½Åµ¿¾ÆÆÄÆ® °°Àº°ÍÀº °Ë»öÀÌ µÇÁö ¾Ê´õ¶ó±¸¿ä.. À§¿¡¼ '%°Ë»ö¾î%'ÇÏ¸é ´ç¿¬È÷ Àúó·³ ³ª¿À¸®¶õ°É ¾Ð´Ï´Ù. ±Ùµ¥ ¾î¶»°Ô ½Åµ¿¾ÆÆÄÆ®´Â °Ë»öÀÌ µÇÁö ¾Ê°Ô ÇÒ¼ö ÀÖÁÒ...? ¾Æ·¡¿Í °°Àº ÀÚ·á°¡ ÀÖÀ»°æ¿ì '%½Åµ¿' Çϸé 1¹ø¸¸ ã½À´Ï´Ù. '%½Åµ¿%' ÇÏ¸é ´Ù Ã£½À´Ï´Ù. '½Åµ¿%' Çϸé 1,2,3¹ø¸¸ ã½À´Ï´Ù. Á¦°¡ ¿øÇÏ´Â°Ç ¾î¶»°Ô °Ë»öÇϸé 1,2,3,4¹ø¸¸À» ãÀ»¼ö ÀÖÀ»±î Çϴ°̴ϴÙ.
+----------------------+ | ½Åµ¿ |--->1¹ø +----------------------+ | ½Åµ¿ 1~279¹øÁö |--->2¹ø +----------------------+ | ½Åµ¿ 280~600¹øÁö |--->3¹ø +----------------------+ | ³íÇöµ¿ ½Åµ¿ |--->4¹ø +----------------------+ | ³íÇöµ¿ ½Åµ¿¾ÆÆÄÆ® |--->5¹ø +----------------------+
############################################################
´äº¯ :
select * from table¸í where column¸í regexp £§Á¤±Ô½Ä£§ ÀÌ·±½ÄÀ¸·Î ÇÏ¸é µÉ°Ì´Ï´Ù.
¿¹¸¦ µé¾î select * from table¸í where column¸í regexp £§ ½Åµ¿$£§ ÀÌ·±½ÄÀ¸·Î ÇÏ¸é ½Åµ¿¾Õ¿¡ ÇÑÄÀÌ ¶ç¿öÁ® ÀÖ°í ½Åµ¿À¸·Î ³¡³ª´Â ¹®ÀÚ¿ÀÌ ÀÖ´Â Ä®·³¸¸ ã¾ÆÁÝ´Ï´Ù. Á¤±Ô½Ä ºÎºÐÀº phpÀÇ ereg()³ª eregi()µî¿¡ »ç¿ëÇÏ´Â Á¤±Ô½ÄÀ» »ç¿ëÇÏ¸é µË´Ï´Ù.
|