Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple questions i think 2

Status
Not open for further replies.

krappleby025

Programmer
Sep 6, 2001
347
NL
i have an sql query

set rs=conn.execute("SELECT * FROM products where class LIKE '" & maingroup & "' ORDER BY autonumber")

and i need to pull any records that contain the maingroup variable, ie if maingroup = test

then i want to pull all with the word test in them

ie

metest
me test
test me
testme
test
complete test phase

etc... how do i do it, i know it has something to do with the * but cant work out where to put it

thanks
 
You need some wild cards in your stetment:
Code:
set rs=conn.execute("SELECT * FROM products where class LIKE '%" & maingroup & "%' ORDER BY autonumber")
Some db's use %'s some db's use *'s as wildcards, the above should work for you now.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
Can't...think...of...anything...funny...to.........say............
need.....coffee....................
 
set rs=conn.execute("SELECT * FROM products where class LIKE '%" & maingroup & "%' ORDER BY autonumber")

Putting % before and after will return all records containing the phrase. Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top