This is a discussion on Extract from MySQL to csv-file within the PHP Language forums, part of the PHP Programming Forums category; I need to output data from a number of MySQL tables in a csv-format where I first have a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 Dobrucki" <Marcin.Dobrucki@TAKETHISAWAY.nokia.com> skrev i en meddelelse news:VOkWc.23505$k4.455801@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 |
|
|||
|
John Jessen wrote:
> > "Marcin Dobrucki" <Marcin.Dobrucki@TAKETHISAWAY.nokia.com> skrev i en > meddelelse news:VOkWc.23505$k4.455801@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/ |
|
|||
|
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.) *** |