>  기사  >  백엔드 개발  >  데이터베이스를 쿼리한 후 배열의 횟수를 세어 그림과 같은 효과를 얻으시겠습니까?

데이터베이스를 쿼리한 후 배열의 횟수를 세어 그림과 같은 효과를 얻으시겠습니까?

WBOY
WBOY원래의
2016-08-08 09:06:54881검색

service_channel은 불만사항 채널이며, 불만사항 수(c), 불만 사항 수는 (t) 동일한 횟수여야 하며 불만 사항 채널이 여러 개 있는 경우 아래 그림과 같은 효과를 얻는 방법은 무엇입니까? ? 자세한 내용은 무시하세요.. 감사합니다^_ ^
0 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

1 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

2 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

3 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

4 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

5 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

6 =>
13 =>

<code>array (size=4)
  'c' => string '6' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

14 =>

<code>array (size=4)
  'c' => string '6' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

15 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

16 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

17 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

18 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

19 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

20 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)
</code>

데이터베이스를 쿼리한 후 배열의 횟수를 세어 그림과 같은 효과를 얻으시겠습니까?

답글 내용:

service_channel은 불만사항 채널이며, 불만사항 수(c), 불만 사항 수는 (t) 동일한 횟수여야 하며 불만 사항 채널이 여러 개 있는 경우 아래 그림과 같은 효과를 얻는 방법은 무엇입니까? ? 자세한 내용은 무시하세요.. 감사합니다^_ ^
0 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

1 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

2 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

3 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

4 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

5 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '12' (length=2)</code>

6 =>
13 =>

<code>array (size=4)
  'c' => string '6' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

14 =>

<code>array (size=4)
  'c' => string '6' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

15 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

16 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

17 =>

<code>array (size=4)
  'c' => string '4' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

18 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

19 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)</code>

20 =>

<code>array (size=4)
  'c' => string '2' (length=1)
  'create_time' => string '2016-08-04' (length=10)
  'archivepath_name' => string '1天' (length=75)
  'service_channel' => string '29' (length=2)
</code>

데이터베이스를 쿼리한 후 배열의 횟수를 세어 그림과 같은 효과를 얻으시겠습니까?

<code>select create_time,service_channel,c,count(*) as '人数' from a group by create_time,service_channel,c</code>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
이전 기사:PHP 체인 호출다음 기사:PHP 체인 호출