Print Page | Close Window

SQL Query Question

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=26848
Printed Date: 29 March 2026 at 10:25am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: SQL Query Question
Posted By: dwhite02
Subject: SQL Query Question
Date 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.



Replies:
Posted By: cmv
Date 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


-------------
and remember: a CRAY is the only computer that runs an endless loop in just four hours ...



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net