|
|
|
|
î¤éÞ / 2008-07-17 / ¿ÀÀü 10:46:52 / 61.78.108.31
Á¶È¸¼ö : 570
|
[Áú¹®] SQL¿¡¼ MOD »ç¿ëÇϱâ |
101ºÎÅÍ 460¹ø±îÁö ÀϷùøÈ£°¡ ºÙ¾î ÀÖ´Â Å×À̺íÀÇ ³»¿ëÀ» º¯°æÇØ¾ß Çß´Ù.
±âÁ¸¿¡ ³»¿ëÀÌ ·£´ýÇüÅ¿´´ø °ÍÀ» Â÷·Ê´ë·Î A, B, C, A, B, C ÇüÅ·Π¹Ù²Ù¾î¾ß Çß´Ù.
óÀ½¿¡ Çß´ø °Í ó·³ ¿¢¼¿ ÆÄÀÏ·Î ¸¸µé¾î ³õ°í import ½Ãų±î ÇÏ´Ù°¡
Ȥ½Ã³ª SQL¿¡ MOD ÇÔ¼ö°¡ ÀÖÁö ¾ÊÀ»±î ÇØ ºÃ´õ´Ï óÀ½¿¡´Â ¿¡·¯°¡ ³µ´Ù.
À¥¿¡ µÚÁ® ºÃ´õ´Ï ¿ª½Ã³ª MOD ÇÔ¼ö¸¦ »ç¿ëÇÏ´Â ¹æ¹ýÀÌ ÀÖ¾ú´Ù.
SELECT *
FROM drug_out
WHERE (hotCod = 'A18') AND (levels = 2) AND ({ fn MOD(drug_id, 3) } = 2)
ÀÌ·¸°Ô SELECT¸¦ ³¯·È´õ´Ï ÀϷùøÈ£°¡ 101, 104, 107ÀÎ °Íµé¸¸ Â÷·Ê´ë·Î ³ª¿Ô´Ù.
UPDATE drug_out
SET type = 'A'
WHERE (hotCod = 'A18') AND (levels = 2) AND ({ fn MOD(drug_id, 3) } = 2)
¶È°°Àº ¹æ¹ýÀ¸·Î UPDATE¸¦ ³¯·È´õ´Ï ´ë¼º°ø!! |
|
|