Example 1 - get all pid's from table2 where status is completed:
SELECT t1.[pid], t1.[pcode] AS [pname]
FROM table2 AS t2 LEFT JOIN table1 AS t1 ON t1.[pid] = t2.[pid]
WHERE t2.[status] = 'completed'
Example 2 - get all pid's from table1 no matter of status:
SELECT t1.[pid], t1.[pcode] AS [pname], t2.[status]
FROM table1 AS t1 LEFT JOIN table2 AS t2 ON t1.[pid] = t2.[pid]