Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    39

    Unanswered: Concatenate fields

    Hi!

    I have a destination table with a Dest_Name field (like 'Los Angeles') and a Dest_State field (like 'CA'). I would like to update Dest_Name so that it would read

    '- CA - Los Angeles'

    How do I update / concatenate fields while also including hyphens?

    Many thanks for saving me more hours of stumbling

    Best from Belgium

    John

  2. #2
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Hello,

    This should do what you want :

    update destination set Dest_Name = CONCAT('- ', Dest_State,' - ',Dest_Name);

    Regards,

    RBARAER

  3. #3
    Join Date
    Sep 2004
    Posts
    39
    Quote Originally Posted by RBARAER
    Hello,

    This should do what you want :

    update destination set Dest_Name = CONCAT('- ', Dest_State,' - ',Dest_Name);

    Regards,

    RBARAER
    So it did ! Thank you very much. I don't find any reference to this 'concat' command in Sams' "Teach yourself sql in 10 minutes" which I thought was the unchallenged reference ...

    Are there any other mystical commands like this one? Any idea where I could find a tutorial?

    Many thanks again & have a splendid day!

    Kind regards

    John

  4. #4
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Glad it helped you !

    There is nothing "mystical" here though, all commands such as this one are in the MySQL manual (and are mostly MySQL-specific, not standard SQL) :

    http://dev.mysql.com/doc/mysql/en/String_functions.html

    Have a pleasant read !

    Regards,

    RBARAER

Posting Permissions

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