Can someone help with these SQL queries? (URGENT)

VBKid04
04-15-2004, 03:49 PM
I am having trouble with this so must hand it over to you, the experts...


Need some SQL queries that can possibly pull some info from across 3 tables...

My tables are like as follows:

QUERY
QueryID, QueryDetails, QueryStatus, UserID, AdminID, CustomerID, TaskID

TASK
TaskID, TaskInfo, SolutionID, UserID, AdminID

SOLUTION
SolutionID, SolutionInfo, TaskID, AdminID


[PS - In the results of these queries, I dont want repeating rows if possible.]


Can someone please show me how to construct the queries for these:
(they're all for the 1 same purpose but I dont know which is best to use)


01.
SELECT All From Query Where Query.ProblemID = Problem.ProblemID WHERE
Problem.SolutionID Is Not Null And Where Problem.UserID or Problem.AdminID =
txtLoginID
[With this one, I want to click a button afterwards, and it will take me to the corresponding SolutionID, where Query.ProblemID=Problem.ProblemID AND Problem.SolutionID=Solution.SolutionID if that makes sense].

02.
SELECT All From Query Where Query.ProblemID = Problem.ProblemID AND
Problem.SolutionID Is Not Null

03.
SELECT All From Problem Where PROBLEM.SolutionID IS NOT NULL and Where
PROBLEM.UserID or PROBLEM.AdminID = txtLoginID.

04.
SELECT All From Problem Where Query.ProblemID = Problem.ProblemID WHERE
Problem.SolutionID is not null.

05.
SELECT All From Problem Where PROBLEM.ProblemID = SOLUTION.ProblemID
and Where Problem.UserID or Problem.AdminID = txtLoginID.



If somebody could also advise me which is the best to use as well, I personally think I maybe need to use 01. but I dont know how.


Thanks for any help.

reboot
04-15-2004, 04:00 PM
"SELECT * From Query Inner Join Problem On Query.ProblemID = Problem.ProblemID " _
"WHERE Not Problem.SolutionID Is Null And Problem.UserID = '" & txtLoginID _
"' Or Problem.AdminID = '" & txtLoginID & "'"

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum