Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Using Concatenate to format text in a sql statement

I'm being asked to use the || operator, combined with the AS operator to format my sql query. For some reason, this is giving me the error "SQL Error: near "AS": syntax error.

Any ideas what Im doing wrong?

Zachary Billingsley
Zachary Billingsley
6,187 Points

Hello!

When you receive an error like that, typically the error will come right after string it gives you.

So your syntax error is most likely right after your "AS" in the query.

To give more help I would need to see the query :P

1 Answer

Giovanni Esposito
Giovanni Esposito
7,830 Points

Hi Chris Gauthier,

Can you share your SQL statement?

Sorry, i assumed that the ask for help feature would include my SQL statement.

Here is my sql statement:

select street || "," || " " || city || "," || " " || state || " " || zip || "." || " " country as address from addresses;