CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Export advice
Pages: [1]

Author Topic: Export advice  (Read 2101 times)

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Export advice
July 18, 2007, 05:39:00 am
we have data in mysql.
My question is related to exporting certain data in to this format "Interest one, Interest Two, Interest Three"
This way during the civi import it will see this Interests column as ONE column with multiple interest.  This then will populate my custom multi select field in civi for that contact with multi choices.
For example
First, last, interests
John, Smith, "Politics, Energy"
Then after the import he will have both chosen in the menu under "Interests".
Right now it works when I import the above example that I hand write out in a csv file. 
What I need is the mysql query to export from the database so instead of giving me a list like this
John, Smith, Politics
John, Smith, Energy
Which overwrites the first one (even as "Update" or "fill" it overwrites the first import on the multi select)
To create an export that says for every John Smith give me his interests in this format.
John, Smith, "Politics, Energy" <--this export would make the import good

Thanks
Alfred

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Export advice
July 19, 2007, 12:07:00 am
Alfred,

Not clear about your mysql database structure. But i guess you can use

DISTINCT (contact id) and GROUP_CONCAT (interests) combination to get the desired records.


- kurund
Found this reply helpful? Support CiviCRM

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: Export advice
July 19, 2007, 05:05:56 am
thanks I will give it a try  :)

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: Export advice
July 19, 2007, 07:49:41 am
Worked GREAT THANKS...

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • Export advice

This forum was archived on 2017-11-26.