Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

I FOUND THE ASWER really it was so easy !

$users = DB::select('SELECT     TOP (10) Home_LogStudents.LogSt_data, Home_LogStudents.LogSt_date, Home_LogStudents.LogSt_studid, Home_Students.home_firstname, Home_Students.home_lastname
FROM         Home_LogStudents
INNER JOIN  Home_Students
ON Home_LogStudents.LogSt_studid = Home_Students.home_id
WHERE     (Home_LogStudents.LogSt_action = 225)
AND (Home_LogStudents.LogSt_sectionID = '.$id.')
AND (Home_LogStudents.LogSt_date IN
                          (SELECT     MIN(LogSt_date) AS Expr1
                            FROM          Home_LogStudents AS Home_LogStudents_1
                            WHERE      (LogSt_data <> \'0\')
                            AND (LogSt_action = 225)
                            AND (LogSt_sectionID = '.$id.') AND (LogSt_studid IN
                                                       (SELECT     Home_Students_1.home_id
                                                         FROM          Hw_StudentClasses INNER JOIN
                                                                                Home_Students AS Home_Students_1
                                                         ON Home_Students_1.home_studid = Hw_StudentClasses.Stclass_studid
                                                         WHERE      (Hw_StudentClasses.Stclass_classid = ' .$class_id.')))
                            GROUP BY LogSt_studid))
ORDER BY Home_LogStudents.LogSt_data DESC
');
0

Sign in to participate in this thread!

Eventy

Your banner here too?

JohnnyPT johnnypt Joined 10 Feb 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.