jeudi 4 juin 2020

Laravel 5.4 order by on multiple table's column

I've to fetch record from two table by using JOIN.The record should come order by Date first and in that date record should be sorted by review column (both in desc order).

All work is done by raw queries and no relation or modals are defined (very outdated code). So what is the possible solution?

Screenshot

select `Feedback`.`FeedbackId`, `Feedback`.`SiteId`, `Feedback`.`MyTestimonial`, `Feedback`.`ReviewDate`,`Feedback`.`Overall` as `F_Overall`, `Feedback`.`Code`, `ProductFeedback`.`PID` as `ProductId`,`ProductFeedback`.`Product` as `ProductName`, `ProductFeedback`.`Rating`, `ProductFeedback`.`FeedbackId` as `ProductFeedbackId`, `ProductFeedback`.`Id` as `PF_Id`,   from `Products` as `Products`  inner join `ProductFeedback` as `ProductFeedback` on `Products`.`Id` = `ProductFeedback`.`PID` inner join `Feedback` as `Feedback` on `Feedback`.`FeedbackId` = `ProductFeedback`.`FeedbackId` where `ProductFeedback`.`Rating` > 0 order by `ReviewDate` desc, `ProductFeedback`.`Rating` desc limit 21 offset 0


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire