|
|
|
|
huck / 2000-01-18 / ¿ÀÈÄ 6:40:26 / 203.228.117.23
Á¶È¸¼ö : 124
|
[Áú¹®] ASP ¿¡¼ SQL °á°ú°ª Àоî¿À´Â ¹æ¹ý.... |
> > ¾È³çÇϼ¼¿ä. ¼ö°í°¡ ¸¹À¸½Ê´Ï´Ù. ^^
> > ´Ù¸§ÀÌ ¾Æ´Ï±¸¿ä... ´ÙÀ½°ú °°Àº ÁúÀǸ¦ Çß½À´Ï´Ù.
> >
> > select date, mdcode, section, total = sum(sale) from chul00003200001t where date>='2000-01-01' and date<='2000-01-16' and mdcode='0001' and section='Á¤»ó' group by mdcode, section, date with rollup
> >
> > ±×¸®°í ±×¿¡ ´ëÇÑ ÁúÀÇ °á°ú´Â ´ÙÀ½°ú °°½À´Ï´Ù.
> > date mdcode section total
> > -------------------- -------------------- -------------------- ------------------------------------------
> > 2000-01-02 0001 Á¤»ó 70400
> > 2000-01-03 0001 Á¤»ó 0
> > 2000-01-04 0001 Á¤»ó 32200
> > 2000-01-05 0001 Á¤»ó 11700
> > 2000-01-06 0001 Á¤»ó 15600
> > 2000-01-07 0001 Á¤»ó 46600
> > 2000-01-08 0001 Á¤»ó 37600
> > 2000-01-09 0001 Á¤»ó 63200
> > 2000-01-10 0001 Á¤»ó 67100
> > 2000-01-11 0001 Á¤»ó 16000
> > 2000-01-12 0001 Á¤»ó 3000
> > 2000-01-13 0001 Á¤»ó 29100
> > 2000-01-14 0001 Á¤»ó 22000
> > 2000-01-15 0001 Á¤»ó 150000
> > 2000-01-16 0001 Á¤»ó 364100
> > (null) 0001 Á¤»ó 928600
> > (null) 0001 (null) 928600
> > (null) (null) (null) 928600
> >
> > (18 row(s) affected)
> >
> > Á¦°¡ ¾Ë°í½ÍÀº°Ç¿ä... ÀúÀ§ÀÇ ÁúÀÇ °á°úÁß¿¡¼ ¸Ç ¾Æ·¡ ³ª¿À´Â '928600'ÀÇ ¼öÄ¡¸¸ ²¨³»¿À°í ½ÍÀº°Ì´Ï´Ù.
> >
> > ±âÁ¸¿¡
> >
> > sql = "select ex from table where ........"
> > set rs = db.execute(sql)
> >
> > ÇÏ´Â ½ÄÀ¸·Î ex°ªÀ» ²¨³»¿À°í ½ÍÀ»¶§´Â
> > rs(0)
> > ÀÌ·±½ÄÀ¸·Î Çߴµ¥¿ä..... À§¿Í°°ÀÌ ±×·ìÀ» »ç¿ëÇؼ °è»êµÇ¾îÁø ¼öÄ¡¸¦ µü ÀÐÀ»¶§´Â ¾îÂîÇØ¾ß ÇÒÁö ¸ð¸£°Ú½À´Ï´Ù.
> >
> > Áú¹®Çϸ鼵µ ÂÍ Ã¬ÇÇÇϱº¿ä...
> > µµ¿ÍÁÖ½Ã¸é °í¸¿°Ú½À´Ï´Ù. ^^
> -----------------------------------------------------------
>
> Àúµµ Á¤È®ÇÏ°Ô´Â Àß ¸ð¸£´Âµ¥... ^^;
>
> with rollup À̶õ°Ô ¹«½¼ ¶æÀÎÁö Àß ¸ð¸£°Ú³×¿ä...
>
> ±×¸®°í ¿øÇÏ½Ã´Â°Ô ¹ºÁöµµ È®½ÇÇÏ°Ô Àß ¸ð¸£°Ú¾î¿ä...
>
> 928600À̶õ °ª Çϳª¸¸À» ¿øÇϽŴٴ °ÇÁö...
>
> ¾Æ´Ï¸é sumÀ» ÇÑ °á°úÀÎ totalÀ̶õ °ªÀ» ¿øÇϽŴٴ °ÇÁö Àß ¸ð¸£°Ú³×¿ä...
>
> ¿¹Àü¿¡ rs(0)´Â ÀÌ·± ½ÄÀ¸·Î Çϼ̴ٰí Çϼ̴µ¥....
>
> ¾îÂ÷ÇÇ group by ÀýÀ» »ç¿ëÇÏ´õ¶ó°í ¸¶Âù°¡Áö°Å´ø¿ä...
>
> rs(0) ÇϽøé data°ªÀ» ¾òÀ¸½Ç¼ö ÀÕ±¸¿ä...
>
> total°ªÀ» ¾òÀ¸½Ã·Á¸é rs(3) ÇÏ½Ã¸é µË´Ï´Ù...
>
> ÀÌ°Ô ¿øÇÏ´Â ´äÀÌ ¸Â³ª ¸ð¸£°Ú³×¿ä... ^^;;;;
>
> ±Ùµ¥ where Àý¿¡¼ dataÀÇ Á¶°ÇÀ» ÁÖ¾ú´Âµ¥ data°¡ nullÀ롂 ¿Ö Ãâ·Â µÇ´Â°ÅÁÒ?
>
> Àü ±×°Ô ´õ ±Ã±ÝÇϳ׿ä... ^^;
>
-----------------------------------------------------------
±×°Ô ¾Æ¸¶(NullÀÌ Ãâ·ÂµÇ´Â°Ô) with rollup ¶§¹®ÀÎ°Í °°±¸¸¸¿ä.
±× ¿Ü¿¡´Â 俵ÀÌ ¸»´ë·Î ÀϹÝÀûÀÎ ¹æ¹ýÀ» È°¿ëÇϸé
µÉ °Í °°Àºµ¥¿ä...
|
|
|
|