Sometimes, the weirdest things happens when we do queries isn’t it? Nevertheless, in order to find the real problem for for that, lets breakdown the SQL and make it easy for the engines to understand. I am telling you, sometimes PDO is funny.
Do not use table aliases even though your query is correct. Let’s see how the command is executed then.
SELECT
PRODUCTS.COMMENTS, VENDOR.COMMENTS
FROM PRODUCTS
LEFT OUTER JOIN VENDOR ON VENDOR.VEN_UID = PRODUCTS.VEN_ID
I’ll give the non-alias SQL version a go and see what happens. My initial motivation behind the alias style was to keep the query itself to a minimum as my queries do get quite large in size…
I’m mainly using this approach for statistical report reasons.
Bingo! That did the trick. I created a random generator for the alias just to test and it worked as expected. I’ll likely switch from random characters to a counter method in the end though.