Hello,
I have a books table which apart from other fields has fields author1, author2, author3 which refer to the id in authors table. author2 and author3 may be 0, which means the book has only 1 author. Issue is how to retrieve author names for author2 and author3 only if they are not 0?
First retrieving the author1, author2, author3 id's and then retrieving their names if they are not 0 is something I can do from php.
I wanted to know if it can be done in a single sql statement. Or is there a better way of organizing the data?
I am using MySQL 5.0
Thank you.