¾È³çÇϼ¼¿ä, HappyCGI ÆÀÀÇ voposÀÔ´Ï´Ù.
>white´Ô²²¼ °¥ÄÑÁֽŰÍÀº ¿¡·¯ ¸Þ¼¼Áö°¡ ³ª¿ä..
>GROUP BY R.id_gongµÚ¿¡ ºÙ¿©µµ ¿¡·¯°¡³ª¸ç....LIMIT 5µÚ¿¡ ºÙ¿©µµ ¿¡·¯°¡ »ý°Ü¿ä..Ȥ COUNT´Â µé¾î°¥ ¼ö ¾ø´Â°Ô ¾Æ´Ñ°¡ÇØ¿ä..
>
>[
SQL ±¸¹®¿¡ ¿À·ù°¡ ÀÖ½À´Ï´Ù.
¿¡·¯ °°À¾´Ï´Ù. (
ORDER BY COUNT desc
¸í·É¾î ¶óÀÎ 2)]
>
>ÀÌÄÉ¿ä....¤Ð¤Ð...
>
>±¸·¡¼ Á»´õ ÀÚ¼¼ÇÏ°Ô Àû¾ú¾î¿ä...
>Á¦ Àǵµ´Â... °øµ¿±¸¸ÅÁß Á¦Ç°À» ÃßõÇÏ´Â Äڳʰ¡ Àִµ¥ ÃßõÀ» ÇÏ¸é ±× ÃßõÇÑ ³»¿ëÀ» ºñ±³ÇÏ¿© ±× °ªµéÁß °¡Àå Å« °ÍºÎÅÍ ºÒ·¯¿À°Ô ÇÒ·Á°í ÇÕ´Ï´Ù.
>
>$que1 = "SELECT S.a_name,COUNT(R.id_gong)
>FROM gong_result R , gong_poll S
>WHERE S.id_gong = R.id_gong GROUP BY R.id_gong LIMIT 5";
COUNT(R.id_gong) À» alias ½ÃÅ°½Ã´Â°É ºü¶ß¸®½Å°É·Î º¸À̴µ¥ ÀÌ·¸°Ô¿ä.
COUNT(R.id_gong) as count
alias ½ÃÅ°Áö ¾ÊÀ¸¸é Á¤·Ä½Ãų¶§ Ä÷³À̸§À» ¸í½ÃÇÒ¼ö°¡ ¾ø°Ú½À´Ï´Ù.
GROUP BY clause ´ÙÀ½¿¡ ORDER BY count DESC, LIMIT 5 ÇÏ½Ã¸é µÉ°Å¿¡¿ä.
$sql = "SELECT S.a_name, COUNT(R.id_gong) as count
FROM gong_result R, gong_poll S
WHERE S.id_gong = R.id_gong GROUP BY R.id_gong ORDER BY count DESC LIMIT 5";
>µÎ°³ÀÇ Å×À̺íÀ» ºñ±³Çϸç DB¸¦ ºÒ·¯¿À°ÔÇÏ´Â Äõ¸®ÀÔ´Ï´Ù..
>µÎ°³ÀÇ Å×À̺íÁß °øÅëÀ¸·Î µé¾î°¡´Â Ä®·³(id_gong)À» ºñ±³ÇÏ¸ç °ªÁß Å« °Í ´Ù¼¸°³¸¦ ºÒ·¯¿Ã·Á°í ÇÕ´Ï´Ù......
>
>white´Ô...ºÎŹµå·Á¿ä....
>
´Ù½Ã ½ÃµµÇغ¸¼¼¿ä. ^^ °¨»çÇÕ´Ï´Ù.
- vopos
|