|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL query help please
I am running a query on my website using a search box, searching for book titles.
I can return the book information if I type in the whole name correctly, however I want to return book titles even if I just match part of the title. For example, if I search for Harry, it would bring up the books Harry Potter etc etc. Is there anyway in SQL to do this? Thanks |
|
#2
|
||||
|
||||
|
yes .You can use like operator of sql. Please could you post your sql query here, so that we can modify it.
just for your info Code:
select * from table_book where title like '%put your variable which contains the data to be search%'
__________________
Nothing is Impossible bcoz IMPOSSIBLE itself says.. I M POSSIBLE........................ Be cool !!!!!!!!
|
|
#3
|
|||
|
|||
|
Thank you, my query is
Code:
SELECT * FROM an_test1 WHERE Title LIKE '"&varsearch&"' I try using % instead of & but I get Invalid character? Last edited by apachehelp : November 19th, 2009 at 04:58 AM. |
|
#4
|
||||
|
||||
|
|
|
#5
|
|||
|
|||
|
Thanks, just solved it
Last edited by apachehelp : November 19th, 2009 at 06:47 AM. |
|
#6
|
||||
|
||||
|
try this
Code:
sql = "SELECT * FROM an_test1 WHERE Title LIKE '%"& varsearch &"%'" |
|
#7
|
|||
|
|||
|
Quote:
Thanks, I had just done it before you replied but thanks for your help. |
|
#8
|
||||
|
||||
|
Quote:
![]() |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SQL query help please |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|