mysql中的GROUP BY子句,具有分组ID' s

时间:2015-02-17 06:36:32

标签: mysql

我的查询是:

SELECT c.ID AS ClientID, c.name AS ClientName, f.ID AS ProjectID,f.formatName 
AS ProjectName,w.ID AS WaveID, w.wave AS WaveName, w.startDate AS StartDate, w.endDate AS 
Enddate

FROM clients AS c
INNER JOIN formats AS f ON f.clientID = c.ID
INNER JOIN waves AS w ON w.formatID = f.ID
WHERE c.ID =52
ORDER BY w.startDate

它的输出如下

ClientID ClientName ProjectID ProjectName          WaveID WaveName StartDate  Enddate
      52 SilkBank         181 Eman Islamic            402 Wave-1   2014-01-13 2014-01-31
      52 SilkBank         180 Branch Banking          400 Wave-1   2014-01-13 2014-01-31
      52 Silk8ank         182 Middle Mkt. Branches    403 Wave-1   2014-01-13 2014-01-31
      52 SilkBank         182 Middle Mkt. Branches    413 Wave-2   2014-02-11 2014-02-28
      52 SilkBank         180 Branch Banking          412 Wave-2   2014-02-11 2014-02-28
      52 SilkBank         181 Eman Islamic            411 Wave-2   2014-02-11 2014-02-28
      52 SilkBank         181 Eman Islamic            428 Wave-3   2014-03-17 2014-03-31
      52 SilkBank         180 Branch Banking          430 Wave-3   2014-03-17 2014-03-31
      52 SilkBank         182 Middle Mkt. Branches    429 Wave-3   2014-03-17 2014-03-31

然后我通过startDate及其输出将其分组如下:

ClientID ClientName ProjectID ProjectName          WaveID WaveName StartDate  Enddate
      52 Silk8ank         182 Middle Mkt. Branches    403 Wave-1   2014-01-13 2014-01-31
      52 SilkBank         181 Eman Islamic            411 Wave-2   2014-02-11 2014-02-28
      52 SilkBank         182 Middle Mkt. Branches    429 Wave-3   2014-03-17 2014-03-31

现在我的问题是,当我将这些waveID分组为单个单元时,它只显示403.我想将分组的ID分组成一个数组或其他东西。

到目前为止,我到处都找到了小组。不知道这叫什么;为什么无法搜索。

任何帮助!!谢谢

0 个答案:

没有答案