|
| |
|
|
pintofale
Posts: 14 Joined: 9/10/2006 Status: offline
|
is it ok to use and or in a clause - 1/22/2008 14:26:36
I am building a search form for an access db and have a statment which uses and/or statments in the clause. I am not sure if the syntax is correct or not. Any help or pointers would be great. this is the statement: Set rs = Conn.Execute("SELECT id, subject, firstname FROM notes WHERE subject LIKE '%%& Request.form("lastname") &%%' OR firstname LIKE '%%& Request.form("firstname") &%%' OR subject LIKE '%%& Request.form("lastname") &%%' AND firstname LIKE '%%& Request.form("firstname") &%%'")
|
|
|
|
rdouglass
Posts: 9186 From: Biddeford, ME USA Status: offline
|
RE: is it ok to use and or in a clause - 1/23/2008 8:16:52
quote:
Set rs = Conn.Execute("SELECT id, subject, firstname FROM notes WHERE subject LIKE '%%& Request.form("lastname") &%%' OR firstname LIKE '%%& Request.form("firstname") &%%' OR subject LIKE '%%& Request.form("lastname") &%%' AND firstname LIKE '%%& Request.form("firstname") &%%'") How about this way: Set rs = Conn.Execute("SELECT id, subject, firstname FROM notes WHERE ((subject LIKE '%" & Request.form("lastname") & "%') OR (firstname LIKE '%" & Request.form("firstname") & "%')) OR ((subject LIKE '%" & Request.form("lastname") &" %') AND (firstname LIKE '%" & Request.form("firstname") &" %'))") Something like that?
_____________________________
Don't take you're eye off your final destination. ASP Checkbox Function Tutorial.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|