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

Lax Shah
Lax Shah
546 Points

Why is the error for and how to rectify it please explain

In the library database there's a patrons table listing all the users of the library. The columns are id, first_name, last_name, address, email, library_id and zip_code. Generate a list of strings that are in the following format: Andrew Chalkley andrew@teamtreehouse.com. Concatenate the first name, last name and email address for all users. Alias it to to_field. This will be used in the "To" field in email marketing. Type in your command below. Get Help Check Work

SELECT first_name ||" "|| last_name ||" "|| email AS to_field FROM patrons;

Added code formatting

2 Answers

Steven Parker
Steven Parker
231,269 Points

Since you didn't use Markdown to format your code, I suspect there are some missing symbols in the example. You also didn't provide a link to the challenge, but if I remember correctly, it was expecting the email to be enclosed in angles, so perhaps you need to add those symbols as you concatenate the string:

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

If that's not it, please provide a link to the challenge page.

John Lukacs
John Lukacs
26,806 Points

No that is what I came up with but it does not pass https://teamtreehouse.com/library/reporting-with-sql/working-with-text/concatenating-text please explain what it is asking

Steven Parker
Steven Parker
231,269 Points

I went to your linked page, copied and pasted in the code line from my answer above, and it passed. I'm not sure why you would not get the same result.