RE: export result from select statement

2011-01-10 Thread Jerry Schwartz
-Original Message-
From: LAMP [mailto:l...@afan.net]
Sent: Sunday, January 09, 2011 9:46 PM
To: mysql@lists.mysql.com
Subject: Re: export result from select statement

maybe it's clear to other but it's pretty unclear.
#mysql -username -p select * from table_name where id=123 
'/home/me/test/test.txt'
actually doesn't work?!?


[JS] The command you wrote doesn't redirect the input of the client. It should 
read

#mysql -username -pxxx dbname  /home/me/testing/text.sql  
/home/me/testing/text.txt

By the way, it is a bad idea to use test as a file or directory name. It is 
very easy to accidentally invoke the test command, which can really make you 
scratch your head.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341
E-mail: je...@gii.co.jp
Web site: www.the-infoshop.com




Jerry Schwartz wrote:
 The technique I've settled on is this:

 mysql blah blah blah  the_select_query.sql  the_output_i_want.txt

 That gives you a tab-delimited text file with column headings.

 Regards,

 Jerry Schwartz
 Global Information Incorporated
 195 Farmington Ave.
 Farmington, CT 06032

 860.674.8796 / FAX: 860.674.8341
 E-mail: je...@gii.co.jp
 Web site: www.the-infoshop.com


 -Original Message-
 From: LAMP [mailto:l...@afan.net]
 Sent: Saturday, January 08, 2011 6:05 PM
 To: mysql@lists.mysql.com
 Subject: export result from select statement

 Hi guys,
 I wonder how to store to csv or txt file result from SELECT query?
 not a whole table nor database. Just results from SELECT query.
 Usually I use MySQL Query Browser and Export feature, but in this
 case I don't have access with MySQL Query Browser. Though, I have a
 command line access.
 I found on one place something like
 #SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
 Though, it doesn't work?!?

 Thanks.

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql?unsub=je...@gii.co.jp












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



RE: export result from select statement

2011-01-10 Thread Jerry Schwartz
-Original Message-
From: Michael Dykman [mailto:mdyk...@gmail.com]
Sent: Sunday, January 09, 2011 3:02 PM
To: LAMP; mysql@lists.mysql.com
Subject: Re: export result from select statement

I  second Jerry's recommendation.  It always works like a charm for me.

[JS] Thanks.

By the way, if your SELECT is easy to type you can use the -e parameter on the 
MySQL command line.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341
E-mail: je...@gii.co.jp
Web site: www.the-infoshop.com



 - michael dykman

On Sun, Jan 9, 2011 at 2:44 PM, Jerry Schwartz je...@gii.co.jp wrote:
 The technique I've settled on is this:

 mysql blah blah blah  the_select_query.sql  the_output_i_want.txt

 That gives you a tab-delimited text file with column headings.

 Regards,

 Jerry Schwartz
 Global Information Incorporated
 195 Farmington Ave.
 Farmington, CT 06032

 860.674.8796 / FAX: 860.674.8341
 E-mail: je...@gii.co.jp
 Web site: www.the-infoshop.com

-Original Message-
From: LAMP [mailto:l...@afan.net]
Sent: Saturday, January 08, 2011 6:05 PM
To: mysql@lists.mysql.com
Subject: export result from select statement

Hi guys,
I wonder how to store to csv or txt file result from SELECT query?
not a whole table nor database. Just results from SELECT query.
Usually I use MySQL Query Browser and Export feature, but in this
case I don't have access with MySQL Query Browser. Though, I have a
command line access.
I found on one place something like
#SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
Though, it doesn't work?!?

Thanks.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=je...@gii.co.jp





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





--
 - michael dykman
 - mdyk...@gmail.com

 May the Source be with you.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=je...@gii.co.jp





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



RE: export result from select statement

2011-01-09 Thread Jerry Schwartz
The technique I've settled on is this:

mysql blah blah blah  the_select_query.sql  the_output_i_want.txt

That gives you a tab-delimited text file with column headings.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341
E-mail: je...@gii.co.jp
Web site: www.the-infoshop.com

-Original Message-
From: LAMP [mailto:l...@afan.net]
Sent: Saturday, January 08, 2011 6:05 PM
To: mysql@lists.mysql.com
Subject: export result from select statement

Hi guys,
I wonder how to store to csv or txt file result from SELECT query?
not a whole table nor database. Just results from SELECT query.
Usually I use MySQL Query Browser and Export feature, but in this
case I don't have access with MySQL Query Browser. Though, I have a
command line access.
I found on one place something like
#SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
Though, it doesn't work?!?

Thanks.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=je...@gii.co.jp





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



Re: export result from select statement

2011-01-09 Thread Michael Dykman
I  second Jerry's recommendation.  It always works like a charm for me.

 - michael dykman

On Sun, Jan 9, 2011 at 2:44 PM, Jerry Schwartz je...@gii.co.jp wrote:
 The technique I've settled on is this:

 mysql blah blah blah  the_select_query.sql  the_output_i_want.txt

 That gives you a tab-delimited text file with column headings.

 Regards,

 Jerry Schwartz
 Global Information Incorporated
 195 Farmington Ave.
 Farmington, CT 06032

 860.674.8796 / FAX: 860.674.8341
 E-mail: je...@gii.co.jp
 Web site: www.the-infoshop.com

-Original Message-
From: LAMP [mailto:l...@afan.net]
Sent: Saturday, January 08, 2011 6:05 PM
To: mysql@lists.mysql.com
Subject: export result from select statement

Hi guys,
I wonder how to store to csv or txt file result from SELECT query?
not a whole table nor database. Just results from SELECT query.
Usually I use MySQL Query Browser and Export feature, but in this
case I don't have access with MySQL Query Browser. Though, I have a
command line access.
I found on one place something like
#SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
Though, it doesn't work?!?

Thanks.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=je...@gii.co.jp





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





-- 
 - michael dykman
 - mdyk...@gmail.com

 May the Source be with you.

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



Re: export result from select statement

2011-01-09 Thread LAMP

Eric Bergen wrote:

select into outfile is the correct way. What do you mean by doesn't
work? Does it give you an error?
  

It was an issue with permissions :-)

Thanks


On Sat, Jan 8, 2011 at 3:04 PM, LAMP l...@afan.net wrote:
  

Hi guys,
I wonder how to store to csv or txt file result from SELECT query? not a
whole table nor database. Just results from SELECT query.
Usually I use MySQL Query Browser and Export feature, but in this case I
don't have access with MySQL Query Browser. Though, I have a command line
access.
I found on one place something like
#SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
Though, it doesn't work?!?

Thanks.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=eric.ber...@gmail.com







  




Re: export result from select statement

2011-01-09 Thread LAMP

maybe it's clear to other but it's pretty unclear.
#mysql -username -p select * from table_name where id=123  
'/home/me/test/test.txt'

actually doesn't work?!?



Jerry Schwartz wrote:

The technique I've settled on is this:

mysql blah blah blah  the_select_query.sql  the_output_i_want.txt

That gives you a tab-delimited text file with column headings.

Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341
E-mail: je...@gii.co.jp
Web site: www.the-infoshop.com

  

-Original Message-
From: LAMP [mailto:l...@afan.net]
Sent: Saturday, January 08, 2011 6:05 PM
To: mysql@lists.mysql.com
Subject: export result from select statement

Hi guys,
I wonder how to store to csv or txt file result from SELECT query?
not a whole table nor database. Just results from SELECT query.
Usually I use MySQL Query Browser and Export feature, but in this
case I don't have access with MySQL Query Browser. Though, I have a
command line access.
I found on one place something like
#SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
Though, it doesn't work?!?

Thanks.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=je...@gii.co.jp







  




Re: export result from select statement

2011-01-09 Thread Yogesh Kore
#mysql -username -p -e  select * from table_name where id=123 
'/home/me/test/test.txt'


On Mon, Jan 10, 2011 at 8:15 AM, LAMP l...@afan.net wrote:

 maybe it's clear to other but it's pretty unclear.
 #mysql -username -p select * from table_name where id=123 
 '/home/me/test/test.txt'
 actually doesn't work?!?




 Jerry Schwartz wrote:

 The technique I've settled on is this:

 mysql blah blah blah  the_select_query.sql  the_output_i_want.txt

 That gives you a tab-delimited text file with column headings.

 Regards,

 Jerry Schwartz
 Global Information Incorporated
 195 Farmington Ave.
 Farmington, CT 06032

 860.674.8796 / FAX: 860.674.8341
 E-mail: je...@gii.co.jp
 Web site: www.the-infoshop.com



 -Original Message-
 From: LAMP [mailto:l...@afan.net]
 Sent: Saturday, January 08, 2011 6:05 PM
 To: mysql@lists.mysql.com
 Subject: export result from select statement

 Hi guys,
 I wonder how to store to csv or txt file result from SELECT query?
 not a whole table nor database. Just results from SELECT query.
 Usually I use MySQL Query Browser and Export feature, but in this
 case I don't have access with MySQL Query Browser. Though, I have a
 command line access.
 I found on one place something like
 #SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
 Though, it doesn't work?!?

 Thanks.

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql?unsub=je...@gii.co.jp













export result from select statement

2011-01-08 Thread LAMP

Hi guys,
I wonder how to store to csv or txt file result from SELECT query?  
not a whole table nor database. Just results from SELECT query.
Usually I use MySQL Query Browser and Export feature, but in this  
case I don't have access with MySQL Query Browser. Though, I have a  
command line access.

I found on one place something like
#SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
Though, it doesn't work?!?

Thanks.

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



Re: export result from select statement

2011-01-08 Thread Eric Bergen
select into outfile is the correct way. What do you mean by doesn't
work? Does it give you an error?

On Sat, Jan 8, 2011 at 3:04 PM, LAMP l...@afan.net wrote:
 Hi guys,
 I wonder how to store to csv or txt file result from SELECT query? not a
 whole table nor database. Just results from SELECT query.
 Usually I use MySQL Query Browser and Export feature, but in this case I
 don't have access with MySQL Query Browser. Though, I have a command line
 access.
 I found on one place something like
 #SELECT 2+2 into outfile '/path/to/specific/directory/test.csv';
 Though, it doesn't work?!?

 Thanks.

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:    http://lists.mysql.com/mysql?unsub=eric.ber...@gmail.com





-- 
Eric Bergen
eric.ber...@gmail.com
http://www.ebergen.net

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