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

General Discussion

II am concatenating three columns and are struggling with the email in the following format <jacques@kil.co.za>.

When I concatenate and have to change the format of for instance the email address, how do I go about. I retrieved the three columns as I should but missing the correct format.

6 Answers

Patrik Horváth
Patrik Horváth
11,110 Points

give link to task :)

nut you can Combine multiple Data Sources by using " || " maybe code below helps :)

SELECT a_name || " " || a_last_name || " " || adress AS UserData FROM table;

in your case

SELECT "<" || email || ">" FROM table;

Thank you Patrik

The Question is: 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.

Below is my query with the results which looks correct to me yet it is saying my query is incorrect.

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

to_fields Andrew Chalkley andrew@teamtreehouse.com. Dave McFarland dave@teamtreehouse.com. Alena Holligan alena@teamtreehouse.com. Michael Poley michael@teamtreehouse.com.

Patrik Horváth
Patrik Horváth
11,110 Points

Problem is "." delete it from end :) i had same issiu :D when i was in this challange

where ?

<" || email || ">."   <- HERE REMOVE "."

to_fields Andrew Chalkley andrew@teamtreehouse.com. Dave McFarland dave@teamtreehouse.com. Alena Holligan alena@teamtreehouse.com. Michael Poley michael@teamtreehouse.com.

Sorry I am still not winning should I only remove the . from the end. This is hwat my query is like and still no luck.

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

Patrik Horváth
Patrik Horváth
11,110 Points

Your SQL Query is good :) but AS to_field no to_fields :), so you think good but misstyping :) keep moving on :)

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

Thank you Partik, I appreciate the help. Need to pay more attention to what is required.