Error Number: 1054
Unknown column 'FI_t1.messageID' in 'on clause'
Line Number: 102
"$query = $this->db->get('community_messages t1', 1);"
SELECT t1.*, t2.toUserID, max(unread) as unread, parentID, deleted, FI_users.userID, email, firstName, lastName, displayName, avatar FROM
FI_community_messagest1
JOIN
FI_community_messagemapt2
ON
t2.
messageID=
FI_t1.
messageIDJOIN
FI_usersON
FI_users.
userID=
FI_t1.
userIDWHERE t1.siteID = 1 AND deleted = 0 AND (t2.toUserID = 3 OR t2.userID = 3) GROUP BY
messageIDLIMIT 1
-
So the function in question is this(https://pastebin.com/haG1ybF7)
Note this was working fine on CodeIgniter 2 encountered this a lot and what seemed to make it work was specifying the from and limit after the select, also ordering the get and join.
So changed the function to this(https://pastebin.com/MeH5aBKH).
Although this works totally fine, I can't help but feel there's a better way of doing this that would make it more readable and easy to understand. This is important as it's on an opensource project for others to use too.
Kind regards.