I have Two Tables Fee and Bill_Fee . Bill_Fee has been made to resolve the many to many relationship between Fee and Bill.
Fee
----------
id
amt
student_id
Bill_Fee
----------
fee_id
bill_id
First the Fee
table should be selected with the help of student_id
and then i need to MINUS
as a set(A={1,2,4,6,8} B={1,2,6,8,9,0}) AB={4}
Like this so that if the fee_id
exists in bill fee
the details of those fees should not be extracted. and Those fee_id
which are not in Bill
should be extracted
you can use sub query
& NOT EXISTS
like this
SELECT *
FROM Fee AS a
WHERE NOT EXISTS (
SELECT *
FROM Bill_Fee AS b
WHERE a.id=b.fee_id
)
there is multiple way to execute query in laravel
you can execute query like this
$sqlQuery = "SELECT ____________";
$result = DB::select(DB::raw($sqlQuery));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.