質問するログイン新規登録

質問編集履歴

4

e

2015/06/04 12:29

投稿

maru--ko
maru--ko

スコア27

title CHANGED
File without changes
body CHANGED
@@ -72,6 +72,8 @@
72
72
  user_id,
73
73
  created_at
74
74
  FROM posts
75
+ WHERE group_id = 1
76
+ ORDER BY created_at DESC;
75
77
  )
76
78
  UNION ALL
77
79
  (
@@ -85,9 +87,7 @@
85
87
  user_id,
86
88
  created_at
87
89
  FROM tweets
90
+ WHERE group_id = 1
91
+ ORDER BY created_at DESC;
88
92
  )
89
- WHERE
90
- group_id = 1
91
- ORDER BY
92
- created_at DESC;
93
93
  ```

3

e

2015/06/04 12:29

投稿

maru--ko
maru--ko

スコア27

title CHANGED
File without changes
body CHANGED
@@ -54,4 +54,40 @@
54
54
  --------------------------------------------------------------------------------------------------------------------------
55
55
  | 1 | null | 1 | hoge | 何か入る | null | 1 | 2015-10-10 10:00:00 |
56
56
  --------------------------------------------------------------------------------------------------------------------------
57
+ ```
58
+
59
+
60
+
61
+
62
+
63
+ ```lang-sql
64
+ (
65
+ SELECT
66
+ group_id,
67
+ id AS post_id,
68
+ NULL AS tweet_id,
69
+ title,
70
+ description,
71
+ NULL AS tweet,
72
+ user_id,
73
+ created_at
74
+ FROM posts
75
+ )
76
+ UNION ALL
77
+ (
78
+ SELECT
79
+ group_id,
80
+ NULL AS post_id,
81
+ id AS tweet_id,
82
+ NULL AS title,
83
+ NULL AS description,
84
+ tweet,
85
+ user_id,
86
+ created_at
87
+ FROM tweets
88
+ )
89
+ WHERE
90
+ group_id = 1
91
+ ORDER BY
92
+ created_at DESC;
57
93
  ```

2

修正

2015/06/04 12:25

投稿

maru--ko
maru--ko

スコア27

title CHANGED
File without changes
body CHANGED
File without changes

1

書式の改善

2015/06/04 12:08

投稿

maru--ko
maru--ko

スコア27

title CHANGED
@@ -1,1 +1,1 @@
1
- MySQL 別テーブルの重行も含めた複雑な条件取得について
1
+ MySQL 複雑な検索条件のデータ取得について
body CHANGED
File without changes