Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Csv Export Of 1->m Tables

forums forums SQLyog Using SQLyog Csv Export Of 1->m Tables

  • This topic is empty.
Viewing 2 reply threads
  • Author
    Posts
    • #28989
      peterlaursen
      Participant

      You will need to write a SELECT query where the server returns the result as you want it. Then you can use SQLyog CSV-port from RESULT tab.

      I do no fully understand your example. I would need some small dumps and a more detailed description (best a screenshot from Excel) of what you want.

      But a simple hint would be to to use concat_ws() function to generate a single result-column with data from more table-columns. Try to compare output of two simple statements

      Code:
      SELECT coloum1, column2 FROM sometable

      and

      Code:
      SELECT concat_ws(',',column1,column2) FROM sometable

      MySQL docs: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html

    • #28990
      blinks2
      Member

      Peter, thank you for your reply. A simpler example and resulting output is –

      SELECT

      searchkey.rk_id AS rk_id,

      searchkey.rk_title AS rk_title,

      searchkey_author.rk_author AS rk_author,

      searchkey_keywords.rk_keywords AS rk_keywords

      FROM searchkey

      LEFT JOIN searchkey_author ON rk_id=rk_author_id

      LEFT JOIN searchkey_keywords ON rk_id=rk_keywords_id

      WHERE rk_id=”12345″;

      yields the following output –

      rk_id rk_title rk_author rk_keywords

      12345 Why physics is the best Brown, B Australia

      12345 Why physics is the best Brown, B physics

      12345 Why physics is the best Smith, J Australia

      12345 Why physics is the best Smith, J physics

      whereas the output I want is –

      rk_id rk_title rk_author rk_keywords

      12345 Why physics is the best Brown, B; Smith, J Australia; physics

    • #28991
      blinks2
      Member

      Problem solved –

      group_concat(DISTINCT searchkey_author.rk_author ORDER BY searchkey_author.rk_author DESC SEPARATOR ';') AS rk_author

      Thanks!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.