CrzySdrs
04-17-2004, 01:40 AM
I have a database with two tables, one is Tasks, the other is People. In the tasks table, I have two columns, assignedby and assignedto which both hold the primary keys for different people in the People table, of which I am trying to get their real names from.
I am trying to combine three querys into one, but I seem to be running into a snag.
Original Querys:
set rs = conn.execute("SELECT * FROM tasks ORDER BY enddate ASC")
set rs2 = conn.execute("SELECT fullname FROM people WHERE uID=" & rs("assignedby"))
set rs3 = conn.execute("SELECT fullname FROM people WHERE uID=" & rs("assignedto"))
rs2 and rs3 queries must be run every time I pull up a different task. I am trying to use the inner join function to pull all of this together and my attempt at it is:
set rs = conn.execute("SELECT * FROM tasks INNER JOIN People ON tasks.assignedto=people.uid ORDER BY enddate ASC")
My problem is I want to get the names for both people, the assigner and the assignee, and the current will only get one of them. I can't seem to write a query that would be able to grab both names in a way I could use.
I am trying to combine three querys into one, but I seem to be running into a snag.
Original Querys:
set rs = conn.execute("SELECT * FROM tasks ORDER BY enddate ASC")
set rs2 = conn.execute("SELECT fullname FROM people WHERE uID=" & rs("assignedby"))
set rs3 = conn.execute("SELECT fullname FROM people WHERE uID=" & rs("assignedto"))
rs2 and rs3 queries must be run every time I pull up a different task. I am trying to use the inner join function to pull all of this together and my attempt at it is:
set rs = conn.execute("SELECT * FROM tasks INNER JOIN People ON tasks.assignedto=people.uid ORDER BY enddate ASC")
My problem is I want to get the names for both people, the assigner and the assignee, and the current will only get one of them. I can't seem to write a query that would be able to grab both names in a way I could use.