I have two tables: pq and pe. I am trying to LEFT OUTER JOIN left table (pq) on right table (pe
Yes. The where clause is turning the left outer join into an inner join.
Why? The value of pe.pqid is NULL (as is pe.uid) when there is no match. So the comparison in the where clause fails (almost all comparisons to NULL return NULL which is considered false).
The solution is to move the comparison to the on clause:
SELECT pq.id, pq.data, pe.data
FROM pq LEFT OUTER JOIN
pe
ON pq.id = pe.pqid and
pe.uid='12345'
ORDER BY pq.id LIMIT 2