Change the date for the 1st record of a link in oracle sql -
i have query want change sales_date '01.01.1800'
1st record product. means want unique product stored in product_id
, check first sales_date
on product loaded , change sales_date
'01.01.1800'
. believe can use rank
function haven't used before , there might solution trying write query this. product_id
value not unique in column.
select product_id,sales_date sales_details
no need rank, can lowest dates using correlated subquery:
select * sales_details sd sales_date <> date '1800-01-01' -- don't update if there's row date , sales_date = -- find row lowest date ( select min(sales_date) sales_details sd2 sd.product_id = sd2.product_id )
when checked it's correct data switch update:
Comments
Post a Comment