1

3つのクエリが完全に機能しています

SELECT snapdate, COUNT( DISTINCT uid) AS t1
FROM table where tid =1
GROUP BY snapdate
ORDER BY snapdate DESC LIMIT 7

クエリ #1:

snapdate        t1
----------      --
2013-07-02      10
2013-07-01      20
2013-06-30      60
2013-06-29      80
2013-06-28      3
2013-06-27      22
2013-06-26      93

クエリ #2:

SELECT snapdate, COUNT( DISTINCT uid) AS t2
FROM table where tid =2
GROUP BY snapdate
ORDER BY snapdate DESC LIMIT 7

snapdate        t2
----------      --
2013-07-02      35
2013-07-01      52
2013-06-30      69
2013-06-29      75
2013-06-28      91
2013-06-27      97
2013-06-26      93

クエリ #3:

SELECT snapdate, COUNT( DISTINCT uid) AS t3
FROM table where tid =3
GROUP BY snapdate
ORDER BY snapdate DESC LIMIT 7

snapdate        t3
----------      --
2013-07-02      22
2013-07-01      22
2013-06-30      26
2013-06-29      27
2013-06-28      29
2013-06-27      29
2013-06-26      29

しかし、3つの結果をまとめて取得する方法がわかりません

snapdate        t1    t2    t3
----------      --    --    --
2013-07-02      10    35    22
2013-07-01      20    52    22
2013-06-30      60    69    26
2013-06-29      80    75    27
2013-06-28       3    91    29
2013-06-27      22    97    29
2013-06-26      93    93    29
4

1 に答える 1