質問編集履歴

3

題名と質問の内容が違うということで変更しました。

2018/05/05 03:03

投稿

enpitsu
enpitsu

スコア8

test CHANGED
@@ -1 +1 @@
1
- データベースから値を取得しcsvファイルに書出す
1
+ SELECT文でデータ値を取得したいが、うまくcountでない
test CHANGED
@@ -1,43 +1,23 @@
1
- よろしくお願いいたします。
2
-
3
1
  **前提・実現したいこと**
4
2
 
5
- wordpressのプラグインslimstatのPV数と訪問数に取得しcsvに書き出したい
6
-
7
- ①「一日毎のPV数を取得したい」
8
-
9
- ![イメージ説明](bd72373c8e3de4c16f7288211bfeb920.png)
10
-
11
- ファイル名:wp-slimstat-reports.php(1231行目)**今日のpv数を表示しているコード**
12
-
13
- <p><?php _e('Today', 'wp-slimstat'); ?> <span><?php echo number_format(wp_slimstat_db::count_records('id', 'dt > '.(date_i18n('U', mktime(0, 0, 0, date_i18n('m'), date_i18n('d'), date_i18n('Y')))), false), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
14
-
15
-
16
-
17
-
18
-
19
- ②S「一日毎の訪問数を取得したい」
20
-
21
- ![イメージ説明](3362870d3b2aca0b780d361c55b395a5.png)
22
-
23
- ファイル名:wp-slimstat-reports.php(1264行目)**訪問数表示しているコード**
24
-
25
- <?php _e( 'Visits', 'wp-slimstat' ) ?> <span><?php echo number_format( $total_human_visits, 0, '', wp_slimstat_db::$formats['thousand'] ) ?></span></p>
26
-
27
-
28
-
29
- テーブル:wp_slim_stats
30
-
31
- カラム:id,ip,other_ip,username,country,referer,resorce,searchterms,plugins,notes,visit_id,server_latency,page_performance,browser,browser_type,platform,langage,use_agent,resolution,screen_with,screen_height,content_type,category,author,content_id,outbound_resouce,dt
3
+ wordpressのプラグインslimstatのPV数を1ごとに取得したい
32
4
 
33
5
 
34
6
 
35
7
  **発生している問題**
36
8
 
37
- SELECT文でデータの値を取得したいが、うまくcountできない
38
9
 
39
- select b.日付, count(b.id) as 'PV数'
40
10
 
41
- from(select date_format(from_unixtime(dt),'%Y-%m-%d') as '日付', id, dt from wp_soumu.wp_slim_stats) b
11
+ 5/4と5/5のPV数を合計して一行で表示したい
42
12
 
13
+
14
+
15
+ select select date_format(from_unixtime(dt),'%Y-%m-%d') as '日付', count(id) as 'PV数'
16
+
17
+ from wp.wp_slim_stats
18
+
43
- group by b.日付
19
+ group by dt;
20
+
21
+
22
+
23
+ ![イメージ説明](79e5a969f928b2814296b21b3482cac9.png)

2

SELECT文追加しました

2018/05/05 03:03

投稿

enpitsu
enpitsu

スコア8

test CHANGED
File without changes
test CHANGED
@@ -35,3 +35,9 @@
35
35
  **発生している問題**
36
36
 
37
37
  SELECT文でデータの値を取得したいが、うまくcountできない
38
+
39
+ select b.日付, count(b.id) as 'PV数'
40
+
41
+ from(select date_format(from_unixtime(dt),'%Y-%m-%d') as '日付', id, dt from wp_soumu.wp_slim_stats) b
42
+
43
+ group by b.日付

1

すみません。発生している問題をついかしました。

2018/05/01 11:33

投稿

enpitsu
enpitsu

スコア8

test CHANGED
@@ -1 +1 @@
1
- データベースから値を取得してcsvに書き出す
1
+ データベースから値を取得してcsvファイルに書き出す
test CHANGED
@@ -1,12 +1,14 @@
1
1
  よろしくお願いいたします。
2
2
 
3
+ **前提・実現したいこと**
4
+
3
- wordpressのプラグイン「slimstat」のPV数と訪問数を日毎に取得しcsvに書き出したい
5
+ wordpressのプラグイン「slimstat」のPV数と訪問数を日毎に取得しcsvに書き出したい
4
6
 
5
7
  ①「一日毎のPV数を取得したい」
6
8
 
7
9
  ![イメージ説明](bd72373c8e3de4c16f7288211bfeb920.png)
8
10
 
9
- ファイル名:wp-slimstat-reports.php(1231行目)**今日のpv数表示**
11
+ ファイル名:wp-slimstat-reports.php(1231行目)**今日のpv数表示しているコード**
10
12
 
11
13
  <p><?php _e('Today', 'wp-slimstat'); ?> <span><?php echo number_format(wp_slimstat_db::count_records('id', 'dt > '.(date_i18n('U', mktime(0, 0, 0, date_i18n('m'), date_i18n('d'), date_i18n('Y')))), false), 0, '', wp_slimstat_db::$formats['thousand']) ?></span></p>
12
14
 
@@ -18,7 +20,7 @@
18
20
 
19
21
  ![イメージ説明](3362870d3b2aca0b780d361c55b395a5.png)
20
22
 
21
- ファイル名:wp-slimstat-reports.php(1264行目)**訪問数表示**
23
+ ファイル名:wp-slimstat-reports.php(1264行目)**訪問数表示しているコード**
22
24
 
23
25
  <?php _e( 'Visits', 'wp-slimstat' ) ?> <span><?php echo number_format( $total_human_visits, 0, '', wp_slimstat_db::$formats['thousand'] ) ?></span></p>
24
26
 
@@ -27,3 +29,9 @@
27
29
  テーブル:wp_slim_stats
28
30
 
29
31
  カラム:id,ip,other_ip,username,country,referer,resorce,searchterms,plugins,notes,visit_id,server_latency,page_performance,browser,browser_type,platform,langage,use_agent,resolution,screen_with,screen_height,content_type,category,author,content_id,outbound_resouce,dt
32
+
33
+
34
+
35
+ **発生している問題**
36
+
37
+ SELECT文でデータの値を取得したいが、うまくcountできない