I have a table with all product sales, the table contain:
id
date
product
make
model
cost
taxes
invoice
Each product sold gets individually inserted to the table so if the customer purchased 3 different products with the same invoice number lets say ( 0009 ) then the table will look like this
product = example one
make = samsung
model = demo one
cost = 100
taxes = 19
invoice = 0009
second inserted product
product = example two
make = samsung
model = demo two
cost = 200
taxes = 38
invoice = 0009
Now the problem is:
I need to show all emited invoices during the day or week or month so I use the follow code:
$invoices = mysqli_query($db, "SELECT * FROM `sales` WHERE `date` = '$today'");
The result I get is all products sold during this date. But I need to show only 1 product per invoice ( because I only need to display the invoice numbers ) and if the invoice has more than 1 product it gets repeated. I know this is because I am not filtering the query but the thing is I do not really know how to achieve this. Anyone know how to do this?
I tried with LIMIT 1 but I get only 1 result ...
EDIT NOTE PLEASE
Some products has no invoice number because I sold those products to friends so the field ( invoice ) is empty, thats why I need to even filter this, that product sales with empty invoice in column do not get displayed