Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Reporting with SQL Working with Text Concatenating Text

Michael Martin
Michael Martin
8,647 Points

What is wrong with my syntax?

I don't understand why this won't work.....................

Michael Martin
Michael Martin
8,647 Points

n an ecommerce database there's a addresses table. There is an id, nickname, street, city, state, zip, country and user_id columns.

Concatenate the street, city, state, zip and country in the following format. Street, City, State Zip. Country e.g. 34 NE 12 st, Portland, OR 97129. USA

Alias the concatenated string as address

This is my code here, as I don't see it attached select street || "," || " " || city, || "," || " " || state || " " || zip || "." || " " || country as address from addresses

Why won't this work?????????????

1 Answer

Steven Parker
Steven Parker
216,136 Points

You were very close! But there should not be a comma after the field name "city".

Michael Martin
Michael Martin
8,647 Points

Cant believe I put that there and didn't see it, thanks for your help Steven!