How to get data from two table and order by second table Datamapper

64 Views Asked by At

My first table is product and second table is user
In product table column is id, user_id,prname etc;
In user table column is id, user_name, rating.

I used this for get

$user = new User();
$user ->get();
$products = new Product();
$products ->get();

Now I want to get products order by user rating

1

There are 1 best solutions below

0
Riead Hossion On

you should create another table for rating where product id and user id and rating value must have with primary key rating id.

then select the product according to rating value.