473,467 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Extract from MySQL to csv-file

I need to output data from a number of MySQL tables in a csv-format where I
first have a header line, then a number of order lines, a new header line,
etc.

What I need is advise on a tool to do this for me, as I assume this is not
possible with for examle MS-Access ?

Will a tool like EMS MySQL Query be of any use? Should mention that I am
absolutely not a programmer, but can use php-myadmin, MS-Access etc.

Thanks.

John
Jul 17 '05 #1
4 3194
John Jessen wrote:
I need to output data from a number of MySQL tables in a csv-format where I
first have a header line, then a number of order lines, a new header line,
etc.


You are banging on the wrong door. This is a PHP group, not MySQL.
But anyway, what you want can be acomplished with:

SELECT .... FROM ... INTO OUTFILE '/tmp/somefile.csv' FIELDS
TERMINATED BY ',';

/Marcin
Jul 17 '05 #2

"Marcin Dobrucki" <Ma*************@TAKETHISAWAY.nokia.com> skrev i en
meddelelse news:VO*******************@news1.nokia.com...
John Jessen wrote:
I need to output data from a number of MySQL tables in a csv-format where I first have a header line, then a number of order lines, a new header line, etc.


You are banging on the wrong door. This is a PHP group, not MySQL.
But anyway, what you want can be acomplished with:

SELECT .... FROM ... INTO OUTFILE '/tmp/somefile.csv' FIELDS
TERMINATED BY ',';

/Marcin


Marcin, you are right, but I could not find a MySQL group :-(
Re your suggestion, please note that I need two different type of lines in
the file: Header-lines and Order-lines. They have different content, and is
this fact that give me worries. MS-Access is a tabular way of doing things,
so I look for a tool that could generate the needed output. Certainly it
could be accomplished by PHP/SQL, but that exceeds my skills!

John
Jul 17 '05 #3
John Jessen wrote:

"Marcin Dobrucki" <Ma*************@TAKETHISAWAY.nokia.com> skrev i en
meddelelse news:VO*******************@news1.nokia.com...
John Jessen wrote:
> I need to output data from a number of MySQL tables in a csv-format where I > first have a header line, then a number of order lines, a new header line, > etc.


You are banging on the wrong door. This is a PHP group, not MySQL.
But anyway, what you want can be acomplished with:

SELECT .... FROM ... INTO OUTFILE '/tmp/somefile.csv' FIELDS
TERMINATED BY ',';

/Marcin


Marcin, you are right, but I could not find a MySQL group :-(
Re your suggestion, please note that I need two different type of lines in
the file: Header-lines and Order-lines. They have different content, and
is this fact that give me worries. MS-Access is a tabular way of doing
things, so I look for a tool that could generate the needed output.
Certainly it could be accomplished by PHP/SQL, but that exceeds my skills!


http://www.phpmyadmin.net/

You export the table as a CSV and there's an option to include the field
names in the first row, if that's what you are meaning. If you're wanting
to get data from one table for the first line, and then another table for
the rest of the file then you are going to have to write some code. Either
that or get the MySQL ODBC driver and link Access as a front end into
MySQL. http://www.mysql.com/products/connector/odbc/

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #4
John Jessen wrote:
I need to output data from a number of MySQL tables in a csv-format where I
first have a header line, then a number of order lines, a new header line,
etc.


If you are writing a PHP program you might think about using the ADODB
Database wrapper. (They moved the site so you have to google for it.) This
comes with some very nice tools, one of which lets you do what you want.

If you want to see a good example go to: http://www.jaya123.com

Click the "demo' button on right side of screen (in red)
Enter 'demo' and 'demo' and click the green check mark
Click Report Menu on left side of screen
Click "Customer by Demographics link at top of screen
In blue criteria screen scoll down and check "headers" and "table"

I think this is exactly what you will want. If you need help in getting this,
let me know.

Al Canton
Adams-Blake Company, Inc.
***
JAYA123 - the web-based total-office system for the
small biz. Order entry, billing, bookkeeping, etc. for $14.95
a month. Everyone says "It's cool as a moose!!"
See why at:http://www.jaya123.com ('ja-eye-ah' means
'victory' in Sanskrit.)
***
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Michel Feldheim | last post by:
Hi everybody, I have some big csv-like files with 15.000 and more artikles stored in it. They should be put into a mysql database. I thought about PHP processing but only the read and print...
11
by: Bruce A. Julseth | last post by:
Newbie Question: Is there a way to import MS Access into MySQL? Maybe create a CSV or something. If so, what would be the SQL to do this? Thanks... Bruce
4
by: Don Crossman | last post by:
Assume a MYSQL table, foo. One column, bar datetime. Two rows: 2004-01-01 08:00:00 2004-02-01 08:00:00 select * from foo where extract(day from bar)=1; 2 rows in set...
3
by: Ruby Tuesday | last post by:
How do I transfer my MS Access DB to MySQL? One issue though, in Access I have some special character such fraction, backquote, etc ... how do I replace those characters to ASCI equivalent...
5
by: Jandre | last post by:
To anyone that can help I have 2 MySQL databases that contain large amounts of tables. I need to be able to compare the data in the tables with older/newer versions of the tables. I figured the...
3
by: ScarletPimpernal | last post by:
Here are my Storage Engine Status. mysql> SHOW ENGINES; +------------+---------+----------------------------------------------------------------+ | Engine | Support | Comment ...
10
by: Sanders Kaufman | last post by:
I have a function that passes a csv string to mysql to use as values: <?php function fnINSERT ($csvValues) { $sSQL = "INSERT INTO mytable ( field_a, field_b, field_b, field_c ) VALUES {...
1
omerbutt
by: omerbutt | last post by:
hi there i am new to php ,have been working in asp classic and access but now have switched to php and mysql,and for the practice sake i started to convert my asp and access based projects into php...
3
by: ahmurad | last post by:
Dear brothers, I have some importnat files in MS Excell / CSV format. I know php. I want to insert these files into MYSQL database to generate reports. What are the techniques to insert the ...
1
by: ahmurad | last post by:
Dear brothers, I have some importnat files in MS Excell / CSV format. I know php. I want to insert these files into MYSQL database to generate reports. What are the techniques to insert the MS...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.