search

Home  >  Q&A  >  body text

Error report of sql concat

Choose from the options below and concatenate the "city" and "state" columns, separated by commas, into a new custom column called "new_address".

SELECT ___()____ new_address FROM customers;

This is how I filled it out

SELECT concat(city,',',state) as new_address FROM customers;

But it’s still wrong

PingPing1177 days ago1171

reply all(6)I'll reply

  • P粉880818043

    P粉8808180432022-10-20 10:25:46

    Do you have an answer? This is the same, English doesn’t work either

    reply
    0
  • 陈磊

    陈磊2021-11-05 14:35:00

    The statement itself should be fine, check whether the entered comma is a comma in English mode

    reply
    0
  • autoload

    autoload2021-11-04 09:13:03

    The concat function does not have the function of specifying a connector when connecting strings. You can use concat_ws. The above example is

    select concat_ws(',',city,state)  as   new_address from customers;

    reply
    0
  • 珠穆朗玛锋

    @p粉 @陈磊 @autoload I have tried all your methods one by one, but I still get an error!

    珠穆朗玛锋 · 2023-04-03 16:19:32
  • Cancelreply