this is mysql query i want to set duplicate value as null or empty
SELECT
som.sale_invoice_id
,CONCAT(cm.first_name,cm.last_name) AS customername
,product_master.product_name
FROM
sale_invoice_master as som
LEFT JOIN customer_master as cm
ON som.customer_id = cm.customer_id
LEFT JOIN product_sale_item_master as soi
ON som.sale_invoice_id = soi.sale_invoice_id
LEFT JOIN product_master
ON soi.product_id =product_master.product_id
LEFT JOIN vehicle_master
ON soi.vehicle_id = vehicle_master.id
This is mycurrent result
| sale_invoice_id | customername | product_name |
|---|---|---|
| 1 | JummakhanDilawarkhan | Apollo TYRE 16.9-28 12PR KRISHAK GOLD -D |
| 1 | JummakhanDilawarkhan | APOLLO TUBE 7.50x16 |
| 2 | PareshKhanchandani | Apollo TL 155R13 AMAZER XL 8PR |
i want this:
| sale_invoice_id | customername | product_name |
|---|---|---|
| 1 | JummakhanDilawarkhan | Apollo TYRE 16.9-28 12PR KRISHAK GOLD -D |
| APOLLO TUBE 7.50x16 | ||
| 2 | PareshKhanchandani | Apollo TL 155R13 |
second duplicate row should be null or empty
I don't have your data to work out with. So what I have done is taken your current result as my primary data and used a query to produce your output:
I have mentioned it all in db-fiddle
Sure enough, you can modify this to use Window Functions as you are using MariaDB 10.4. I have just mentioned a possible solution.