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

Development Tools Database Foundations SQL Calculating, Aggregating and Other Functions Grouping, Joining and Cleaning Up

Sean Flanagan
Sean Flanagan
33,235 Points

IFNULL

Hi. I'm at 4 minutes 14 seconds in the video. I've tried to run the syntax below but got an error:

SELECT title, MIN(score) AS minimum_score, 
MAX(score) AS maximum_score, 
IFNULL(AVG(score).0) AS average 
FROM movies LEFT OUTER JOIN reviews 
ON movies.id = reviews.movie_id 
GROUP BY movie_id;

As far as I'm aware, this is the same as Andrew's, so I don't understand why it works for him but not for me.

I'd appreciate any help.

Sean Flanagan
Sean Flanagan
33,235 Points

@Corey: Hi Corey. Thanks for clarifying this and sorry for the delay. When I looked at the video, it looked like a dot especially as I couldn't see a space between it and the 0. It was so small.

I would up vote your answer and give you Best Answer but neither option shows up here. Thank you. :-)

2 Answers

You should have a comma instead of a period in your ' IFNULL(AVE(score).0) ' .... statement. It should be

IFNULL(AVG(score), 0)