Skip to content
Advertisement

Tag: sql

How can I find the mix of 2 fields with a like in SQL/Laravel?

I have a table posts which contains posts (id field, candidate_id field and text field). I also have a candidate table (id, first_name, last_name). Now, I want to implement a method that would let me put some text, for example: “Mike Doe” and it would give me all the posts that contain “Mike Doe” or that the candidate first_name +

MySQL SUM of multiple rows from multiple table

I am trying to get the sum of multiple rows from 2 different tables, but somehow the result returns multiple rows. I need to get the SUM of quotation_item_amount (group by quotation_id) and invoice_item_amount (group by invoice_id) and if I query unpaid quotation, I need to get WHERE SUM(invoice) < SUM(quotation) So here’s my sample table The result that I

Advertisement