SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Zealot ICO's Avatar
    Join Date
    May 2005
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    importing/exporting multiple tables?

    hey all,

    I have three related tables that need data manually edited, I'm using phpMyAdmin to export the tables in CVS excel format for field editing, is there a way to join those tables together for export? Right now they look like this in excel;

    id table1 field1
    01 xxxxxxxxxx
    02 xxxxxxxxxx
    03 xxxxxxxxxx

    id table2 field1
    01 xxxxxxxxxx
    02 xxxxxxxxxx
    03 xxxxxxxxxx

    id table3 field1
    01 xxxxxxxxxx
    02 xxxxxxxxxx
    03 xxxxxxxxxx

    I'm having a hard time editing as the tables show up one after the other, I'd like to export them like this;

    id table1 field1 table2 field1 table3 field1
    01 xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx
    02 xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx
    03 xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx

    how can this be accomplished? and how would i later import the updated fields?

    I'm new to SQL and phpMyAdmin I'd really appreciate your help

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,216
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    what you're asking to do is pretty complicated

    may i ask why you don't just edit your tables in phpmyadmin?

    how big are the edits, i.e. how many rows? how often do you need to edit all three tables?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot ICO's Avatar
    Join Date
    May 2005
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    what you're asking to do is pretty complicated

    may i ask why you don't just edit your tables in phpmyadmin?

    how big are the edits, i.e. how many rows? how often do you need to edit all three tables?
    I only need to do this once, I have around 1500 rows

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,216
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    does each of the three tables contain the exact same number of rows with equal ids in all three tables?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Zealot ICO's Avatar
    Join Date
    May 2005
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    does each of the three tables contain the exact same number of rows with equal ids in all three tables?
    they should, yes

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,216
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Code:
    SELECT t1.id 
         , t1.field1 AS table1field1
         , t2.field1 AS table2field1
         , t3.field1 AS table3field1
      FROM table1 AS t1
    INNER
      JOIN table2 AS t2
        ON t2.id = t1.id
    INNER
      JOIN table3 AS t3
        ON t3.id = t1.id
    i haven't used phpmyadmin in years but i think you just need to paster that into the SQL window and then there's a button to Export the query
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •