Mysql search query two columns

前端 未结 3 1071
悲哀的现实
悲哀的现实 2021-01-24 10:40

I\'m bulding a search function for my web site and wish to search by two columns: title and author.

Query:

SELECT title, bookID, publisher, pubDate, boo         


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-24 10:59

    SELECT title, bookID, publisher, pubDate, book_image, books.authorID, authors.author 
    FROM books, authors 
    WHERE books.authorID = authors.authorID 
            AND (title LIKE '$queryString%' OR author LIKE '$queryString%')LIMIT 5
    

    this should do the work

提交回复
热议问题