Forum Thread
by member
  Posts  
mysql export (Forums : Tech Support : mysql export) Locked
Thread Options
TKAzA
TKAzA Community Manager
Mar 26 2013, 6:40pm Anchor

Hello Chaps.

I'm having a issue exporting a column from a mysql table, i need a specific column as i need to use the field then run a replace query on them, the current export is only doing the whole sheet, with one line per row, with all the column details in the first row of the exel document.

I need the first row and column to just consist of the url column from the table, any ideas?

Aaron

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Mar 26 2013, 6:52pm Anchor

So if I get you right you are looking to export a single colon from an excel sheet into CSV or SQL? Or do you need to query a single colon from an SQL DB table?

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

TKAzA
TKAzA Community Manager
Mar 26 2013, 7:29pm Anchor

The latter my good sir.

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Mar 26 2013, 9:08pm Anchor

Well, to get a single colon from an SQL DB table you simply use the SELECT command similar to this:
SELECT colonName FROM tableName;

What you did is most probably selecting all colons which would:
SELECT * FROM tableName;

You can also filter while export:
SELECT colonName FROM tableName WHERE colonName = value;

Or sorting:
SELECT colonName FROM tableName WHERE colonName = value ORDER BY colonName {ASC|DESC};

Replace by itself you can do directly in the DB without any export. Would look something like this:
UPDATE tableName SET colonName = value WHERE condition;

That is if you plan to set the same value to all colons matching your condition.

How the export looks like though depends on your DB client. I hope I understood correctly what you are looking for. Otherwise just ask again.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

TKAzA
TKAzA Community Manager
Apr 1 2013, 2:21pm Anchor

ok next issue, got the exports sorted but i need to sort the table data so each line matches with the correct url
if the line goes to another url it wont work, a to z sorting doesnt work, any thoughts?

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Apr 1 2013, 3:13pm Anchor

Sorting works  from inside Excel as well as from inside the DB. In Excel just select all lines (and all columns containing data) and use the sort feature. The program keeps lines together while sorting. In the DB just use the ORDER BY clause as mentioned above. This keeps also the lines together.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

TKAzA
TKAzA Community Manager
Apr 1 2013, 4:28pm Anchor

i have the two table sets but the urls differ so its not sorting it 1-1
My original idea was to export the url data, then find and replace all the old url data with the new stuff and export it, however i need 2 corresponding columns of information, i have them, but they need to match each other.

Dragonlord
Dragonlord Linux-Dragon of quick wit and sharp tongue
Apr 1 2013, 6:58pm Anchor

So if I get this right you've got two tables let's say A and B with each having an url somewhere (let's say A.url and B.url). You want to merge-sort them. Assuming there is a property A.link and B.link that match each other you can do this using a JOIN clause. This would look like this:

SELECT * FROM A INNER JOIN B ON ( A.link = B.link ) ORDER BY A.url ;

The INNER JOIN simply creates a new temporary table out of table A and B linking rows where A.link matches B.link . The ORDER BY applies then to the joined table and delivers the result you want.

--

User Posted Image
Leader, Head Programmer: Epsylon | Drag[en]gine Game Engine

User Posted Image by Salohcin

Reply to Thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.