|
-
Nov 29th, 2007, 07:59 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Retrieving three author names, two may be empty
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|