In the last episode (Nov 28), armando said:
> i have a question, i'm searching for a while and do not find some
> reference how to do that.
> 
> a simple query return this:
>
> dato1 dato2 dato3 estado1 fecha1
> dato1 dato2 dato3 estado2 fecha2
> dato1 dato2 dato3 estado3 fecha3
> dato4 dato5 dato6 estado1 fecha4
> dato4 dato5 dato6 estado2 fecha5
> dato4 dato5 dato6 estado3 fecha6
> ....
> 
> and i need this:
> 
> dato1 dato2 dato3 fecha1 fecha2 fecha3
> dato4 dato5 dato6 fecha4 fecha5 fecha6
> ....
> 
> any help?, and i'm sorry por my english.

The group_concat() function might help you here.  It will return
"fecha1,fecha2,fecha3", which you can then split in your application code. 
Make sure you don't include your the "estado" or "fecha" columns in the
GROUP BY clause (in your case you would want to group by the first three
columns only).

http://dev.mysql.com/doc/refman/5.1/en/group-by-functions.html#function_group-concat

-- 
        Dan Nelson
        dnel...@allantgroup.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to