I'm having a bit of trouble trying to get the DISTINCT statement to work with mySQL. What I'm trying to do is return a list of 'books by the same author' on a php page that displays a single book. Current statement looks something like this:
SELECT book_id, title FROM titles WHERE author LIKE '%$author%' AND title != '$this_title'
My problem is, there are duplicates in the database. So, for instance, I might have 'Farewell to Arms' by Ernest Hemingway in the DB three times, one for paperback, one for hardcover, and one for large print. When I'm looking at 'The Old Man and the Sea', I want it to show only one copy of 'Farewell to Arms,' under 'Other books by Ernest Hemingway' not all three. I don't care which version is shown. I thought I could use DISTINCT to do this, but I can't get it to work how I would like it to.
Can someone school me on generating unique results?