This is the result table of mysql query:
SELECT m.movieID, m.title, m.released_date_order, mt.movie_trailer_id
FROM movie m
LEFT JOIN movie_trailer mt ON mt.movieID = m.movieID
WHERE m.status !=0
AND (m.released_date_order >= '2013-10-20' AND m.released_date_order <= '2014-10-20')
ORDER BY mt.movie_trailer_id IS NOT NULL , mt.movie_trailer_id ASC , m.title
But it's close to the result i want.
The result should be,
1) Display first the movies that has NULL values in movie_trailer_id column.
2) Then sort them by m.title in ASC order.
3) After the result in 1 and 2, then display the movies that doesn't have NULL values in the movie_trailer_id column.
4) And lastly, sort them also by m.title in ASC order.
As you can see on the table, the movies with NOT NULL values aren't sorted in the proper way. Anyone can give me the correct query?