Which type of db are you using? Why are you using the generic PreparedSQLStatement? This is the base class for the db specific classes that you should be using.
mysql Ver 15.1 Distrib 10.0.31-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
SELECT
CONCAT(MODEL_1.YEAR, MODEL_1.MONTH) AS YD, AEX_MONTH.AVG_MONTH, MODEL_1.AVG_MONTH AS M1,
IFNULL(MODEL_1.AVG_MONTH_M2,0) AS M2
FROM MODEL_1
LEFT JOIN AEX_MONTH
ON AEX_MONTH.YEAR = MODEL_1.YEAR
AND AEX_MONTH.MONTH = MODEL_1.MONTH
I don’t see any reason this query would cause issues. Are you issuing a SQLSelect right after preparing the statement? Exactly when does the error occur - after the Prepare statement or after the SQLSelect statement?
To be honest, I might have been to lazy in programming. I use one select session method to do all DB handling to limit the open DB sessions. Works fine. The obvious thing in this case to enable it to switch to a non prepared select. And obviously that works fine!