Oracle 中去除重复列数据的sql?
select batch.batch_id as b_id,batch.batch_name,batch.created_by,batch.created_date,dt.po_no,dt.pr_form_no as pr_no,
pr.applicant_id,pr.REQUEST_ORG_ID,pr.SUBMIT_ON,dt.material_id,dt.material_name,dt.material_code,dt.DELIVERY_NO,
dt.WAREHOUSE_ID,pr.REQUEST_ORG_NAME
from pur_f_delivery_batch batch
inner join pur_f_delivery_dt dt on dt.BATCH_ID=batch.batch_id
inner join pur_pr_item_work item on item.id=dt.PR_WORK_ID
inner join pur_pr pr on pr.id=item.pr_id
我的sql 语句就是上的
,现在我想b_id,created_by,dt.DELIVERY_NO, 这三个字段来判断数据的重复,只有和这三个字段相同的数据,只显示一条就可以,其它的不用显示
请看清楚问题,重复数据 只显示一条
------解决方案--------------------用这个吧,上一个粘贴错了
select *
from (select row_number() over(partition by batch.batch_id, batch.created_by, dt.DELIVERY_NO order by batch.created_date) rn,
batch.batch_id as b_id,
batch.batch_name,
batch.created_by,
batch.created_date,
dt.po_no,
dt.pr_form_no as pr_no,
pr.applicant_id,
pr.REQUEST_ORG_ID,
pr.SUBMIT_ON,
dt.material_id,
dt.material_name,
dt.material_code,
dt.DELIVERY_NO,
dt.WAREHOUSE_ID,
&nb