Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Wrong error message

Link to question: https://teamtreehouse.com/library/reporting-with-sql/working-with-text/getting-the-length-of-a-string My code: select title, length(title) as longest_title from books order by length(title) desc limit 1; Answer: Harry Potter and the order of the Phoenix The answer above is in the column "title" the column next to it is "longest_length" I checked to make sure this was the correct by retrieving all the titles in the descending order. So I know I've got the correct answer.

However, I'm getting an error message saying: Bummer: Your query didn't return the longest length

Thank you! I caught that soon after I posted :)

1 Answer

Steven Parker
Steven Parker
221,254 Points

You have the right book, but the wrong column name.

The instructions say, "Alias the result of the length calculation to be longest_length".
But your query aliases it to "longest_title" instead.