--This query is returning a "too many values" error. I'm not sure why?
update myTable
set var1= var2
WHERE value1 IN (
WITH X AS
(
select value1, value2, var1,var2, ROW_NUMBER()
OVER
(PARTITION BY value1 ORDER BY value1 desc) as rn
from
mytable WHERE var1 is null AND rownum>0 and rownum<=10 order by value1 asc
)
SELECT
value1, value2, var2,var1
FROM X WHERE rn=1 and var1 is null and rownum>0 and rownum<=10);
Aucun commentaire:
Enregistrer un commentaire