Hi,
I'm trying to write a query that when a user enters a search term in a text box such as Computing, it will then check whether there are any adverts available with Computing in their title.
The tables are:
advert2
(advert_id, username, mod_book_id, asking_price, condition, description, date_added)
ts_module_books
(id, module_code, essential_useful, author, book_title, publisher, pub_year)
the query im using is:
"select * from ts_module_books inner join advert2 on advert2.mod_book_id = ts_module_books.id where ts_module_books.book_title LIKE '%$search%'"
However, what i want outputting to the page is
book_title, author and publisher from ts_module_books,
and also user from the advert2 table.
Is this possible? And if so, how do i do this?
Thanks.
Lou
sql query help
Moderator: General Moderators
-
forgodsake8
- Forum Newbie
- Posts: 9
- Joined: Fri Feb 27, 2004 8:30 pm
- andre_c
- Forum Contributor
- Posts: 412
- Joined: Sun Feb 29, 2004 6:49 pm
- Location: Salt Lake City, Utah
like this?
Code: Select all
SELECT ts_module_books.*, advert2.username FROM ....