I have an "unknown column in field list" error in my sql query that I cannot figure out. I read there could be hidden characters so I manually typed and ensured the column names are correct. I tried different queries which worked fine. In this case Query 1 can query the table and columns but Query 2 errors out with Unknown column 'rec.ID' in field list
Query 1:
SELECT rec.`ID` FROM rec; // works fine
Query 2:
// error
SELECT
rec.`ID`,
rec.`Status Type`,
lender.`ID`,
lender.`Cost Per`
FROM
( SELECT rec.`ID`, rec.`Status Type` FROM rec) AS T1
JOIN (SELECT lender.`ID`, lender.`Cost Per` FROM lender) AS T2
ON T1.`ID` = T2.`ID`
WHERE rec.`Lead Type` = "Activated"