Walter Schrabmair
Walter Schrabmair

Reputation: 1341

How can I group by this table?

could someone tell my how I could make this, please with MySQL statement?

Table input:

    col1   col2    col3
     B              C
     A      D    
     A              E

Output should be:

    line 1:  B              C
    line 2:  A      D       E

THe maximal rows for every input line in INPUT Table is 2. (here you see it with A)

Thanks

Upvotes: 0

Views: 31

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562358

Given the example you show, this would work:

SELECT col1, MAX(col2), MAX(col3)
FROM InputTable
GROUP BY col1

Upvotes: 1

Related Questions