SELECT * FROM table1 WHERE pid = 21
SELECT * FROM table2 WHERE pid = 21
The downside to this is that if both tables have an id of 21, both tables will return the associated records. But if there is only ONE table with an id of 21, this will retrieve that one.
Also, unless the ID is in a column of datatype char/varchar/nchar/nvarchar/text etc, you shouldn't need the apostrophe around 21; int/tinyint/bigint etc aren't strings.