php - SQL SELECT query not working - unable to find error -


the following select query search keyword 'law' multiple tables tbl_books, tbl_author , tbl_books_subject

select * tbl_books p, tbl_books_author d, tbl_books_subject m p.title = 'law'    or d.author = 'law'    or m.subject = 'law' limit 0,30 

this query giving error. please me it.

you can achieve in single query need have foreign key in other tables. here check code below.

select b.*, ba.*, bs.* tbl_books b     full outer join tbl_books_author ba on ba.book_id=b.id     full outer join tbl_books_subject bs on bs.book_id=b.id b.title 'law' or ba.author 'law' or bs.subject 'law' limit 0, 30; 

look @ query can see have used tbl_books.id make joins should in other tables identify particular records.

hope helped you.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -