10 months ago

Converting mysql to laravel query

Posted 10 months ago by jhutto

I have a mysql query that I can not figure out how to translate into Laravel query in controller

The 355 will be a variable as soon as I can get this to run.

SELECT somascourseregistrations.id, `CourseID`, `StudentID`, `StatusID`, `TA`, `DropDate`, `TuitionType`, (`ClassFee`+`HomeOfficeFee`+`MaterialsFee`) AS TotalTuition,
(SELECT SUM(`PaymentAmount`) AS TotalPayments FROM `somasstudentclasspayments` WHERE somasstudentclasspayments.RegistrationID = somascourseregistrations.id) TotalPayments
FROM `somascourseregistrations` WHERE somascourseregistrations.CourseID = 355

Please sign in or create an account to participate in this conversation.