473,672 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ 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 3203
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******** ***********@new s1.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******** ***********@new s1.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
23638
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 of these lines using the read_csv() function as in the attached script has a more-minutes execution time. What would be the better solution.. a Visual Basic written import tool that uses ODCB or a PHP using one?
11
15184
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
3263
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
2569
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 when transfering to MySQL, or do I have to do it outside MySQL? Thanks
5
9330
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 easiest way would be to get the info in csv format and then run a comparison. I can get all the data using MySQL front, but this has to be done tabe-by-table, and is too time consuming. I am new to Python and also new to programming.
3
1905
by: ScarletPimpernal | last post by:
Here are my Storage Engine Status. mysql> SHOW ENGINES; +------------+---------+----------------------------------------------------------------+ | Engine | Support | Comment | +------------+---------+----------------------------------------------------------------+ | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | | MEMORY | YES |...
10
1963
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 { $csvValues); return mysql_query($sSQL); }
1
2094
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 and mysql, i have a inventory system in which i have a stock entry Portion which has aloots of fields concerning to the codeno,partno, auto , product,quantity, size, height and lots of other fields too but our main concern is with these two "CODENO...
3
2169
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 Excell / CSV files into MySQL? Your kind quick reply is highly appreciated.
1
2163
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 Excell / CSV files into MySQL? Your kind quick reply is highly appreciated.
0
8502
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8943
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8696
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6254
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4239
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2836
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 we have to send another system
2
2089
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1834
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.