Using the dreamweaver recordset you should be able to pull that information back very easily.
Create a new recordset. Click Advanced
Then enter your query and enter the parameter as something like colname (the dreamweaver standard)
SELECT *
FROM table1 LEFT JOIN table2 ON table1.iID=table2.pID
WHERE pID = colname
Then create a new parameter by clicking the plus icon.
Give it a name. The name needs to match the parameter in the query so call it colname. Select the type of data. i.e Date, Text, Integer. Set a default value of -1 and then set a run time value. This can be a session variable or value from a previous recordset on the page.
And thats it!
Cheers
Ian