Veysel Harun Sahin wrote:
I have table with the fields id, name and number. In the table there
are several records with the same id and name but different numbers.
For example:
First record - id: 1, name: John, number: 5
Second record - id: 1, name: Joe, number: 4
Third record - id: 2, name: Richard, number: 1
I want to select records from the table by grouping with id field. I
use groupby for this. But i also want to see all the number fields'
datas in a group side by side. I have written down the list which i
want to see after the query.
First record - id: 1, name: John, number: 54
Second record - id: 2, name Richard, number: 1
Is there any idea about how to write a query to get this result?
Not in plain SQL as far as I can tell. You can write a custom aggregate
function to concatenate the fields, then it becomes pretty
straightforward.
Igor Tandetnik