sql - String Concatenation with comma -


i trying build string comma space. how can remove space between zipcode , country_name? here string. thank suggestion.

select     (coalesce(address + ', ', '') +     coalesce(city + ', ', '') +     coalesce(state_code + ' ', '') +     coalesce(zipcode + ' ', '') +     coalesce(country_name + '', '')) address table1 a_id = 2 

here result:

tewt, test ct, de 4444                 united states 

you can use rtrim function remove white space right side of variable. check ltrim left cases.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -