내일은 대한입니다.
sun's longitude:299 22 14.02 
· 자유게시판 · 묻고답하기 · 알파문서 · RPMS list
· 사용자문서 · 팁/FAQ모음 · 리눅스Links · 자료실
· 서버정보 · 운영자 · Books/FAQ · FreeBSD
/board/read.php:소스보기  

질문과 답변 게시판입니다.

현재 실시간으로 이곳 서버의 설정파일(몇개)를 보여주고 있습니다.
서버의 설정내용에 관한 질문은 먼저 이곳 서버의 설정내용을 참고하시길 바랍니다.

[*** 쓰기 금지단어 패턴 ***]
글 본문 중간에 업로드할 이미지를 추가하는 방법 : @@이미지이름@@
ex) @@foo.gif@@
2052 번 글의 답장글: Re: Re: Re: Re: php-count 질문좀...
글쓴이: 김성민 글쓴날: 2004년 05월 08일 20:28:45 토(저녁) 조회: 913
SELECT COUNT(*) AS count,process FROM orderinfo WHERE ordertime <= '1084028400'
and ordertime >= '1083942000' GROUP BY process;

+-------+---------+
| count | process |
+-------+---------+
|     1 |       0 |
|     1 |       1 |
|     3 |       2 |
+-------+---------+

요렇게 나옵니다.???
지금 데이터에는요.

+ 전체로우 5개,
+ process='0' 인거 1개.
+ process='1' 인거 1개.
+ process='2' 인거 3개.

이렇게 있는건 맞습니다.


전체 n개.
process='0' 인거 n개.
process='1' 인거 n개.
process='2' 인거 n개.

요걸 php로 어떻게 출력하는지요???
 죄송...


[산이]님이 남기신 글:

>
>[김성민]님이 남기신 글:
>
>>죄송... 이해가..
>>
>>mysql> SELECT COUNT(*) AS count FROM orderinfo WHERE ordertime <= '1084028400'
and ordertime >= '1083942000' GROUP BY process;
>
>
>SELECT COUNT(*) AS count,process FROM orderinfo WHERE ordertime <= '1084028400'
and ordertime >= '1083942000' GROUP BY process;
>
>이것을 한번 실행해 보세요.
>
>
>>+-------+
>>| count |
>>+-------+
>>|     1 |
>>|     1 |
>>+-------+
>>2 rows in set (0.00 sec)
>>
>>일케 나오는데.. where process='0' and ordertime... 이러면
>>+-------+
>>| count |
>>+-------+
>>|     1 |
>>+-------+
>>이러구요..
>>
>>알려주신 쿼리를 이용해
>>
>>1 : process 조건을 안준 전체갯수
>>2 : process='0'인 갯수
>>3 : process='1'인 갯수
>>4 : process='2'인 갯수
>>
>>ordertime <= '1084028400' and ordertime >= '1083942000'
>>이 조건은 공통.
>>
>>이걸 echo 문으로 값을 출력할수 있도록 예제를 한번 주시면
이해하는데 빠를것 같습니다.ㅎㅎ
>>
>>지금 시간관련코드와
 group by 의 용도에 대해서 책을 보고 공부중인데
어렵군요...
>>
>>
>>[산이]님이 남기신 글:
>>
>>>
>>>[김성민]님이
 남기신 글:
>>>
>>>>안녕하세요.

>>>>
>>>>안된다고들 하는데 혹시나 방법이 있는가
궁금해서요.
>>>>
>>>>$process1=mysql_fetch_array(mysql_query("select count(id) from orderinfo
where ordertime <= '$tommorow' and ordertime >= '$today' and process='0' and
dbstatus='1'"));
>>>>
>>>>$process2=mysql_fetch_array(mysql_query("select count(id) from orderinfo
where ordertime <= '$tommorow' and ordertime >= '$today' and process='1' and
dbstatus='1'"));									
>>>>$process3=mysql_fetch_array(mysql_query("select count(id) from orderinfo
where ordertime <= '$tommorow' and ordertime >= '$today' and process='2' and
dbstatus='1'"));	
>>>>
>>>>echo $process1[0];
>>>>echo $process2[0];
>>>>echo $process3[0];
>>>>
>>>>이와 같이 count로 갯수를 셀때 process='0' 이 조건 때문에 각기
쿼리를 해야하는데,
>>>>
>>>>
>>>>count(process='0') 과 같이 count 에 조건을 줄수 있는지 궁금
합니다.
>>>>안된다면 위와 같은 쿼리를 한번의 쿼리로 해결이 되는가가
궁금 합니다. 
>>>
>>>========================================
>>>
>>>$sql = "SELECT COUNT(*) AS count FROM ... WHERE ... GROUP BY
process"
>>>
>>>으로 한번 해보세요. 
>>
>>======================================== 
>
>======================================== 

========================================

 
이전글 : Re: Re: Re: php-count 질문좀...
다음글 : Re: Re: Re: Re: Re: php-count 질문좀...  
 from 211.42.174.112
JS(Redhands)Board 0.4 +@

Re: Re: Re: php-count 질문좀... Re: Re: Re: Re: Re: php-count 질문좀...
인쇄용 


apache lighttpd linuxchannel.net 
Copyright 1997-2026. linuxchannel.net. All rights reserved.

Page loading: 0.01(server) + (network) + (browser) seconds