dbTalk Databases Forums  

Exporting a mysql table with links

comp.databases.mysql comp.databases.mysql


Discuss Exporting a mysql table with links in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bruce
 
Posts: n/a

Default Exporting a mysql table with links - 12-19-2010 , 10:33 AM






How can I create a CSV data file with a foreign key converted to its
value?

For example, in the table I want to export (mytable) I have a field
"dataid" with a value of 1. The link table (mylinktable) has a dataid
of "1" pointing to "My Value."
I want to completely export the table, mytable, as a CSV file with
"dataid" resolved to a field name of "mydata" and field value of "My
Value."

How do I do this?

Thanks...

Bruce

Reply With Quote
  #2  
Old   
J.O. Aho
 
Posts: n/a

Default Re: Exporting a mysql table with links - 12-19-2010 , 01:50 PM






bruce wrote:
Quote:
How can I create a CSV data file with a foreign key converted to its
value?

For example, in the table I want to export (mytable) I have a field
"dataid" with a value of 1. The link table (mylinktable) has a dataid
of "1" pointing to "My Value."
I want to completely export the table, mytable, as a CSV file with
"dataid" resolved to a field name of "mydata" and field value of "My
Value."
To get the values you want you need to do a sql query something like:

SELECT table1.column1, table1.column2, table2.column2 FROM table1 INNER JOIN
table2 ON(table1.column3 = table2.column1)



--

//Aho

Reply With Quote
  #3  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: Exporting a mysql table with links - 12-19-2010 , 01:59 PM



On 12/19/2010 11:33 AM, bruce wrote:
Quote:
How can I create a CSV data file with a foreign key converted to its
value?

For example, in the table I want to export (mytable) I have a field
"dataid" with a value of 1. The link table (mylinktable) has a dataid
of "1" pointing to "My Value."
I want to completely export the table, mytable, as a CSV file with
"dataid" resolved to a field name of "mydata" and field value of "My
Value."

How do I do this?

Thanks...

Bruce
You'll have to SELECT the data, JOINing the two tables together, then
build your CSV file from the results.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #4  
Old   
bruce
 
Posts: n/a

Default Re: Exporting a mysql table with links - 12-19-2010 , 05:34 PM



On Dec 19, 2:50*pm, "J.O. Aho" <u... (AT) example (DOT) net> wrote:
Quote:
bruce wrote:
How can I create a CSV data file with a foreign key converted to its
value?

For example, in the table I want to export (mytable) I have a field
"dataid" with a value of 1. The link table (mylinktable) has a dataid
of "1" pointing to "My Value."
I want to completely export the table, mytable, as a CSV file with
"dataid" resolved to a field name of "mydata" and field value of "My
Value."

To get the values you want you need to do a sql query something like:

SELECT table1.column1, table1.column2, table2.column2 FROM table1 INNER JOIN
table2 ON(table1.column3 = table2.column1)

--

* //Aho
Got it. Thanks....

Bruce

Reply With Quote
  #5  
Old   
bruce
 
Posts: n/a

Default Re: Exporting a mysql table with links - 12-19-2010 , 05:35 PM



On Dec 19, 2:59*pm, Jerry Stuckle <jstuck... (AT) attglobal (DOT) net> wrote:
Quote:
On 12/19/2010 11:33 AM, bruce wrote:

How can I create a CSV data file with a foreign key converted to its
value?

For example, in the table I want to export (mytable) I have a field
"dataid" with a value of 1. The link table (mylinktable) has a dataid
of "1" pointing to "My Value."
I want to completely export the table, mytable, as a CSV file with
"dataid" resolved to a field name of "mydata" and field value of "My
Value."

How do I do this?

Thanks...

Bruce

You'll have to SELECT the data, JOINing the two tables together, then
build your CSV file from the results.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck... (AT) attglobal (DOT) net
==================
Got it.. Thanks...

Bruce

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.