RE: sqli select output into comma separated

RE: sqli select output into comma separated

 

  

our app must be using a very old version of sybase, can't get any of the
suggested commands... I am going to have to pipe the output into `tr "\t"
"," `

-----Original Message-----
From: Anthony Molinaro
[mailto:mysqldba-ezmlmshield-x29467573.[Email address protected]
Sent: Wednesday, July 13, 2005 10:42 AM
To: LazyDBA Discussion
Subject: RE: sqli select output into comma separated


Use the GROUP_CONCAT function:

mysql> select deptno, ename from emp order by 1;

+--------+--------+
| deptno | ename |
+--------+--------+
| 10 | MILLER |
| 10 | KING |
| 10 | CLARK |
| 20 | FORD |
| 20 | ADAMS |
| 20 | SCOTT |
| 20 | JONES |
| 20 | SMITH |
| 30 | BLAKE |
| 30 | MARTIN |
| 30 | TURNER |
| 30 | WARD |
| 30 | JAMES |
| 30 | ALLEN |
+--------+--------+


mysql> select deptno, group_concat(ename) from emp group by deptno;

+--------+--------------------------------------+
| deptno | group_concat(ename) |
+--------+--------------------------------------+
| 10 | MILLER,KING,CLARK |
| 20 | FORD,ADAMS,SCOTT,JONES,SMITH |
| 30 | BLAKE,MARTIN,TURNER,WARD,JAMES,ALLEN |
+--------+--------------------------------------+


hope that helps,
Anthony

-----Original Message-----
From: Boseck Martin
[mailto:mysqldba-ezmlmshield-x52454971.[Email address protected]
Sent: Wednesday, July 13, 2005 10:18 AM
To: LazyDBA Discussion
Subject: sqli select output into comma separated


#sqli
select * from table

I need the output to be in comma delimited format.

Is there an easy way to get data output into CSV?

Thanks...


---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To unsubscribe, e-mail: mysqldba-[Email address protected]
Website : http://www.LazyDBA.com



---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To unsubscribe, e-mail: mysqldba-[Email address protected]
Website : http://www.LazyDBA.com

MySQL LazyDBA home page