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 trialDomenic Crump
2,707 PointsHow do you concatenate 3 columns?? I'm so confused, it's Challenge Question 1 Reporting w/ SQL
Trying to generate a list of strings with first_name, last_name, and email and alias it to the "to_field"
2 Answers
KRIS NIKOLAISEN
54,971 PointsYou can keep concatenating as many columns as you want
SELECT column1 || ' ' || column2 || ' ' || column3 AS my_new_column FROM table;
Here's another example with answer provided. If that is what you are working on a lot of people get tripped up on the <> surrounding the email.
KRIS NIKOLAISEN
54,971 PointsThe concatenation operator (for SQLite) is ||. So for example you can concatenate two columns with a space between them as follows:
SELECT column1 || ' ' || column2 AS my_new_column FROM table;
Domenic Crump
2,707 PointsHey Kris, thanks so much for helping out! I understand how to join 2 columns, but what would it look like when if someone were to join 3?
Domenic Crump
2,707 PointsDomenic Crump
2,707 PointsThanks, Kris!