- Where Developers Learn, Share, & Build Careers


I have a MySQL DB, which should be exported in the CSV file. Google told me about so many examples to do this, but all the examples are for exporting only one table.

Can someone help export some data (given below) in a particular way?

  • The album

    the artist

  • Name
  • Name

    Title

    • ID
    • artist_id
    • Name < / Li>

      There are FK fields in the title, which point to artist name and album name. P>

      3 (title)


      John latest, first song
      John, work on progress, good song
      John, California, Oh SF - Luke, Mai songs, a song
      Luke, my songs, two Songs
      Luke, Archived Tom, My Works, Second Song - Tom, My Works, III Songs

      TIA

      You can create a view and export from there.

      Expand Mahesh's query:

        View View View as Visual Editor, name as artist_name, album.name as album_name, title.name AS Title , Titled Artist, Album, Title WHERE artist.id = title.artist_id and album.id = title.album_id; SELECT * FROM 'OUTFILE' example_output.csv 'FIELDS defined by FIELDS' in 'view_example', ';   

      I tested it and it works.

  • Comments

    Popular posts from this blog

    Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

    java - How not to audit a join table and related entities using Hibernate Envers? -

    mongodb - CakePHP paginator ignoring order, but only for certain values -