Reputation: 1
I have an issue with a table while querying the data. This table consists of duplicate data but in a vice versa Manner (see screenshot below for a better understanding), with two lines of data in the table. However, I want only one row of data for each duplicate. Kindly suggest best logic or approach to solve this.
Upvotes: 0
Views: 87
Reputation: 2200
Try this
select distinct Business_unit,
case vocher_ID < vocher_ID2 then vocher_ID else vocher_ID2 end as vocher_ID,
vendor_id,name1,invoice_id,pss_invc_id_nospl,gross_amt,business_unit2,
case when vocher_ID < vocher_ID2 then vocher_ID2 else vocher_ID end as vocher_ID2,
vendor from ps_dup_inv_cmp
Upvotes: 1