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 trialMary Urban
6,321 PointsConcatenate objective for Reporting with SQL
I don't know what I am doing wrong with this statement for this objective - tells me I am not returning the email in the correct format
Thanks
SELECT first_name || " " || last_name AS "FULL NAME", email AS "to_field" FROM patrons;
Alexander Davison
65,469 PointsLike what Jason Anello said, we need to know which code challenge you are on to be able to help you :)
Please provide a link to the challenge and the task you are on, the question of the task, etc.
Thank you for your patience! ~alex
2 Answers
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsThat is probably the link to challenge
https://teamtreehouse.com/library/reporting-with-sql/working-with-text/concatenating-text
The problem with your solution is quite simple.
The e-mail you have to write is
Andrew Chalkley <andrew@teamtreehouse.com>
The e-mail you obtain with your SQL query, that is
SELECT first_name || " " || last_name AS "FULL NAME", email AS "to_field" FROM patrons;
Is the following e-mail
Andrew Chalkley andrew@teamtreehouse.com
So you see the difference ? You forgot to add brackets "<", ">" on both sides.
Jason Anello
Courses Plus Student 94,610 PointsHi Alexander,
As a heads up, I think the "Get Help" button on database code challenges isn't working which is why I think we're seeing so many questions without links to the challenge.
Also, there's one more problem with the query. 2 separate columns are being returned here but the challenge wants the name and email all concatenated into 1 column.
Mary Urban
6,321 PointsThanks for the responses, and here is my link:
https://teamtreehouse.com/library/reporting-with-sql/working-with-text/concatenating-text
But yes, I think you are right Jason, I clicked right on the challenge so I was hoping that would link directly to it, but I guess it didn't, thanks for bringing this up, as this seemed to happen to me last week as well.
When I try to string the email like this it gives me the error below.
>SELECT first_name || " " || last_name AS "FULL NAME" || " " || email AS "to_field" FROM patrons;
>SQL Error: near "||": syntax error
If I write >SELECT first_name || " " || last_name AS "FULL NAME" || " " || <email> AS "to_field" FROM patrons;
As suggested, by Alexander, I still get the same error - I didn't know I was supposed to use brackets in the query around email???
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 PointsYou have to do it in one field, like Jason said and alias that as to_field
You also have to put quote marks around brackets
If you feel still lost to find solution
check the community answere here
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Mary,
Can you link to the challenge that you're on?