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

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
229,670 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.