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 Reporting with SQL Working with Text Concatenating Text

Michael Martin
Michael Martin
8,653 Points

This statement works in SQL Playground, aliasing three values as to_field, what am I doing wrong with this question?

select first_name || " " || last_name || " " || "<" || email || ">" as "to_field" from patrons where first_name = "Andrew"

What is wrong with this query? if I change the variables around, it works just fine in the playground, am I misunderstanding what to alias it to/as?

Michael Martin
Michael Martin
8,653 Points

I got this to work, didn't understand question.......................

1 Answer

You've got a "" in between the last_name and the '<' where there shouldn't be one. In the playground it wont matter as it will just bring back the results. However, in the task it is asking for specific results so it will see that extra space and automatically think it's wrong.

try and compare your task to this. I have tested the code below and know this works.

SELECT first_name || " " || last_name || ' <' || email || '>' AS to_field FROM patrons;

:)

Michael Martin
Michael Martin
8,653 Points

I figured it out, I was looking at the question wrong, but I really appreciate your response