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.


String concatenation query is not working

I am in Challenge Task of Reporting with SQL course. I am facing an issue of a query. In SQL stimulator query works perfectly but, in tasks it's not working.

SELECT first_name || " " || last_name || " <" || email || ">." as "name" FROM patrons;

We need concatenation in Firstname Lastname <email>. as a string.

Can anyone help me out!

Thanks! Rutvij

2 Answers

Steven Parker
Steven Parker
216,136 Points

You didn't link to the challenge, but one thing in the query looks odd.

:point_right: There seems to be a stray period after the angle (>) in the last bit of the concatenated string.

Also, if this is for the challenge I'm thinking of, instead of name the alias should be to_field.

And FYI: it doesn't hurt anything but you don't need those quotes around the aliased name.

Yes! I modified the field name to not violate the solution. "< " is not attaching to the string. Do you have any idea? I tried all the possible solutions but it won't work. "< " concatenation works perfectly in SQL practice window. You can check it out. If you have any alternative idea it would be a great help.

Thanks for your support! I really appreciate it.