I am trying to update the first record clubcode + campaigncode + region based on their tenureyear. (Tenureyears is causing the duplicate records but I need them)
This works in T-SQL but not Teradata
update MYTable
set qtyupdate =(SELECT quantity
FROM codes
WHERE MYTable.clubcode=codes.clubcode
AND MYTable.campaigncode=codes.campaigncode
and MYTable.region=codes.region)
where identity_column in (select top 1 x.identity_column from MYTable X where x.qtyupdate = MMYTable.qtyupdate order by x.tenureyears)
It is only updating 1 records on the table and I also get error 3706 cannot use order by in subqueries.