Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - SQL Query Question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

SQL Query Question

 Post Reply Post Reply
Author
dwhite02 View Drop Down
Newbie
Newbie


Joined: 10 October 2004
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote dwhite02 Quote  Post ReplyReply Direct Link To This Post Topic: SQL Query Question
    Posted: 17 January 2009 at 9:09am
Hi Everyone,
 
I am having some problems with a query on an ASP web page.
 
Situation is that I have two tables, as shown below.
 
I am trying to generate a recordset where the result is all reocrds from Table1 where Table1 ID = Table2 JobID and Table2 UserID does not equal a certain number (querystring).
 
This should give me all jobs in Table1 that the querystring has not been assigned. Make sense?
 -----------------------
Table1
ID (Auto)
JobAddress
 
Table2
ID (Auto)
JobID
UserID
-----------------------
 
I hope someone can help.
 
Thanks.
Back to Top
cmv View Drop Down
Newbie
Newbie


Joined: 22 May 2009
Location: vienna
Status: Offline
Points: 36
Post Options Post Options   Thanks (0) Thanks(0)   Quote cmv Quote  Post ReplyReply Direct Link To This Post Posted: 22 May 2009 at 10:40pm
str = Trim(Request.QueryString("UserID"))
If str = "" OR NOT IsNumeric(str) Then intUserID = -1 ELSE intUserID = CInt(str) ' or CLng(str)
strSQL = "SELECT Table1.* FROM Table1 INNER JOIN (SELECT JobID FROM Table2 WHERE UserID <> " & intUserID & ") t ON Table1.ID = t.JobID"
hth, christian
 
ps: very old post as i just notice ... sorry for bringing that up again in case this is not according to the forum ruies
Back to Top
 Post Reply Post Reply

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.