dimanche 6 décembre 2020

i am using laravel query builder having function but it throws error non grouping field but the same query works fine on workbench

this is the query which i am trying to get from database in laravel but it throws error non-grouping field subject but it works fine on workbench and return result

$qry = "SELECT t5.Id AS id,t5.UID as testUID,( SELECT IF(COUNT(t1.Id) > 0,'yes','no') FROM test_usertest t1 WHERE t1.UserId = {$_userId} AND t1.TestId = t5.Id ) as isParticipated,( SELECT GROUP_CONCAT(t2.Subject) FROM test_subject t2 WHERE t2.Id IN (SELECT t1.SubjectId FROM test_testsubject t1 WHERE t1.TestId = t5.Id AND t1.Status = 1) ) as subject,t5.Title AS title,t5.startTime,t5.totalMarks,t5.maxEntry,t5.duration,t5.description,t5.registrationCoin, t5.status,t5.isNegativeMarks,t5.timeStamp,t5.updateTimeStamp FROM test_test t5 HAVING subject LIKE '%{$_request['subject']}%'"; $data = DB::SELECT($qry);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire