Gossamer Forum
Home : General : Databases and SQL :

Problem on SQL select ...

Quote Reply
Problem on SQL select ...
I wanted to do a select on

strSQL = "SELECT * FROM Info WHERE Name = '" & userid & "'"(This code work fine)
which display only all the Name = to userid.


But how to combine this
strSQL = "SELECT * FROM Info WHERE Name = '" & userid & "'"


with this

strSQL = "SELECT * FROM Info WHERE INSTR(Info.Name,'" & strSearch & "')"

so i can search the database within the Name = userid only
Quote Reply
Re: [gnehs] Problem on SQL select ... In reply to
It looks like you have a few errors in that code such as missing quotes. Anyway, just combine then as you would any other statement, with a BOOLEAN.

SELECT * FROM Info WHERE Name = userid AND INSTR(Info.Name, strSearch)