Home  >  Article  >  Backend Development  >  After querying the database, count the number of times in the array and achieve the effect as shown?

After querying the database, count the number of times in the array and achieve the effect as shown?

WBOY
WBOYOriginal
2016-08-08 09:06:54922browse

service_channel is the complaint channel, the number of complaints (c), the number of complaints should be (count(t) the same number of times) How to achieve the effect of the picture below when there are multiple complaint channels? Ignore the details.. Thank you^_^
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>

After querying the database, count the number of times in the array and achieve the effect as shown?

Reply content:

service_channel is the complaint channel, the number of complaints (c), the number of complaints should be (count(t) the same number of times) How to achieve the effect of the picture below when there are multiple complaint channels? Ignore the details.. Thank you^_^
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>

After querying the database, count the number of times in the array and achieve the effect as shown?

<code>select create_time,service_channel,c,count(*) as '人数' from a group by create_time,service_channel,c</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php chain callNext article:php chain call