Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Multiple SQL "where" clauses
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple SQL "where" clauses

 Post Reply Post Reply Page  12>
Author
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Topic: Multiple SQL "where" clauses
    Posted: 18 February 2005 at 12:29am

I know that when using sql you can go  WHERE blahblahblah AND blahblahblah, and that you can have a where that is dependent on user input, but is it possible to have a query that has multiple user dependent WHERE clauses? Help appreciated

Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 18 February 2005 at 5:34am
Won't somthing like below give you what you want?

SELECT tblAuthor.Username, tblAuthor.User_code, tblAuthor.Password, tblAuthor.Author_email, tblAuthor.Show_email, tblAuthor.Homepage
FROM tblAuthor
WHERE (((tblAuthor.Username)="ddff") AND ((tblAuthor.User_code)="dfdf") AND ((tblAuthor.Password)="dfdf"));

How do want multiple where caluses?

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 18 February 2005 at 10:20am
You can only have ONE where clause in SQL
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2005 at 5:21pm
I need it to be something like
"SELECT * from x WHERE 1.x=" request.form(1) AND 2.x = request.form(2)
 
That doesn't work becuase it thinks that i'm looking for 1.x equalling "request.form(1) and 2.x = reuqest.form(2)"


Edited by ub3rl337ch3ch - 20 February 2005 at 5:21pm
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2005 at 5:28pm
Phat, thanks, the brackets thing seems to be working.
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2005 at 11:08pm
gah, I just went back to it and the bloody bracket thing just stopped working... if anyone has any suggestions, i might just be convinced not to throw the computer in front of a truck...
Back to Top
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2005 at 2:56am
you may want to use or instead of and
Back to Top
dj1811 View Drop Down
Newbie
Newbie


Joined: 11 February 2005
Status: Offline
Points: 26
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj1811 Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2005 at 6:18pm
Originally posted by ub3rl337ch3ch ub3rl337ch3ch wrote:

I need it to be something like
"SELECT * from x WHERE 1.x=" request.form(1) AND 2.x = request.form(2)
 
That doesn't work becuase it thinks that i'm looking for 1.x equalling "request.form(1) and 2.x = reuqest.form(2)"
 
"SELECT * FROM x WHERE 1.x=" & Request.Form("1") & " AND 2.x=" & Request.Form("2")
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.