Mysql
 sql >> Database >  >> RDS >> Mysql

La query SQL SELECT non funziona - impossibile trovare l'errore

Hai bisogno di tre SELECT separati (e probabilmente una ricerca con caratteri jolly):

SELECT *
FROM tbl_books
WHERE title LIKE '%law%'
LIMIT 0,30

SELECT *
FROM tbl_books_author 
WHERE title LIKE '%law%'
LIMIT 0,30

SELECT *
FROM tbl_books_subject
WHERE title LIKE '%law%'
LIMIT 0,30

Se restituisci risultati compatibili potresti unirli:

SELECT 'book   ', title
FROM tbl_books
WHERE title LIKE '%law%'

UNION ALL

SELECT 'author ', author
FROM tbl_books_author 
WHERE title LIKE '%law%'

UNION ALL

SELECT 'subject', subject
FROM tbl_books_subject
WHERE title LIKE '%law%'
LIMIT 0,30