Space between data using CONCAT

I’ve successfully combined data from two columns using this script:

mysql_query("UPDATE catkey SET category_subcategory = CONCAT(category,subcategory)") or die(mysql_error());

I’d like to put 4 blank spaces between the data in category and the data from subcategory when CONCAT fills the category_subcategory column. I’ve tried several variations of the above script without success.

How to I need to change my script to add 4 blank spaces between the data?

there are two ways to do it

UPDATE catkey
   SET category_subcategory =
          [COLOR="Blue"]CONCAT_WS[/COLOR]('    ',category,subcategory)

UPDATE catkey
   SET category_subcategory =
          [COLOR="blue"]CONCAT[/COLOR](category,'    ',subcategory)

i prefer the former method

if you’d like to know how they differ, the mysql manual has a pretty decent explanation

:slight_smile:

Thanks for your help r937.