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 »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Capitalising Last and First and getting Sort name and Display Name to update
Pages: 1 [2]

Author Topic: Capitalising Last and First and getting Sort name and Display Name to update  (Read 3593 times)

jimmyjam

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 4
Re: Capitalising Last and First and getting Sort name and Display Name to update
October 21, 2010, 10:06:41 pm
I upgraded MySQL to version 5.1.51, and ran this SQL statement:

Code: [Select]
UPDATE civicrm_contact set sort_name = CONCAT_WS (', ', last_name, first_name)
WHERE contact_type LIKE 'Individual'
AND last_name IS NOT NULL;

It worked beautifully.  Thanks again, Peter.

-James

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Capitalising Last and First and getting Sort name and Display Name to update
October 22, 2010, 02:20:47 am
great - glad it helped
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Capitalising Last and First and getting Sort name and Display Name to update
November 05, 2010, 05:00:05 pm
seems the issue is that some mysql versions don't permit a 'space' after the function name - hence try
Code: [Select]
UPDATE civicrm_contact set sort_name = CONCAT_WS(' ,', last_name, first_name) where sort_name like '%@%' and last_name is not null
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Capitalising Last and First and getting Sort name and Display Name to update

This forum was archived on 2017-11-26.