This is what im trying to run in full:
$data = $this->db->select('main.UID, main.value')
->select('twitch_streams.UID AS twt')
->select('(SELECT value FROM user_profile WHERE UID = main.UID AND key = "twitch" AND subkey = "update" LIMIT 1) AS check', null, FALSE)
->from('user_profile AS main')
->join('twitch_streams', 'twitch_streams.UID = main.UID', 'left')
->where('key', 'account')
->where('subkey', "TWT")
->get();
With this it returns:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key = "twitch" AND subkey = "update" LIMIT 1) AS check FROM (`user_profile` AS m' at line 1
But if I shorten the SELECT to ->select('(SELECT value FROM user_profile WHERE UID = main.UID LIMIT 1)', null, FALSE)
it doesn't return an error but it returns the wrong value as the key: [(SELECT value FROM user_profile WHERE UID = main.UID LIMIT 1)] => 1405874916 )