0

I have a query which is:

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

it has the output as follows

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

then i have grouped this by startDate and its output as follows:

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

Now My question is when i grouped these waveID into single unit it only display the 403. and i want to get the grouped id's into an array or something.

So far i have found group by everywhere. don't know what this is called that;s why unable to search.

Any help!! Thanks

Strawberry
  • 33,750
  • 13
  • 40
  • 57
DDay
  • 100
  • 1
  • 1
  • 9
  • possible duplicate of [Can I concatenate multiple MySQL rows into one field?](http://stackoverflow.com/questions/276927/can-i-concatenate-multiple-mysql-rows-into-one-field) – Peter Lang Feb 17 '15 at 07:25
  • It's called group-concatenation, but why do you want to do this? In general, problems of data display are best handled in the presentation layer/application level code (e.g. a PHP loop), assuming that's available. – Strawberry Feb 17 '15 at 08:17
  • @Strawberry yes it is called group-concatenation, i need this because i have to use those grouping id's somewhere in my PHP script for further purpose. – DDay Feb 17 '15 at 09:33
  • That's just daft. Do the data processing in PHP – Strawberry Feb 17 '15 at 09:53
  • And what's a poject? – Strawberry Feb 17 '15 at 10:03
  • @Strawberry really? okay that is the solution i already have. can you tell me how this is daft? can't we make it like this. – DDay Feb 17 '15 at 10:55
  • You can (and I told you what to search for if you insist upon doing that way), but it's at the cost of scalability and flexibility; there's just no point. – Strawberry Feb 17 '15 at 11:02

0 Answers0