Hello All, I am very new to HeidiSQL and am still fumbling my way around. I wrote the below Query but was wondering if there was a way to remove duplicate lines from the data based on id_workorder (WO#). Basically if there is a duplicate WO# remove the duplicate row (keeping the first occurance) so I only get unique id_workorder (WO#) numbers - see attached picture for desired result.
Thank you to anyone who can help!!
SELECT
t1.id_workorder AS `WO#`,
CAST(IFNULL(FROM_UNIXTIME(IF(t1.date_quoted=0, NULL,t1.date_quoted), '%Y-%m-%d'), 0)AS DATE) AS `Date Quoted`,
(SELECT `name` FROM crm_customer WHERE id_primary = t1.id_customer) AS `Customer Name`,
t1.labour_total,
t1.labour_pct_discount,
t1.labour_sub_discount,
t1.labour_special_pct_discount,
t1.labour_special_sub_discount,
t1.labour_sub_total,
t1.parts_total,
t1.parts_pct_discount,
t1.parts_sub_discount,
t1.parts_sub_total,
t1.charge_unit_total,
t1.charge_special_total,
t1.charge_freight_total,
t1.tax_total,
t1.grand_total,
t2.id_type
FROM
winnipeg.erp_quoting AS t1
JOIN
erp_rework AS t2
ON
t1.id_workorder = t2.id_workorder
WHERE
t1.date_quoted > UNIX_TIMESTAMP() - ((86400 * 30) * 30)
ORDER BY
t1.date_quoted DESC`