I am trying to run an update query.
Table PS_Z_TREND_NOW_TBL contains columns DESCR254 and URLS.
I am using PSPRSMDEFN which has many columns including PORTAL_LABEL and URLS. I want to run the below update query to update the PS_Z_TREND_NOW_TBL.URLS column where the values match for PS_Z_TREND_NOW_TBL.DESCR254 and PSPRSMDEFN.URLS. What do I need to change/add in the query below to make this work? When I try to run the below query it gives an error stating, 'single row subquery returns more than one row'
UPDATE PS_Z_TREND_NOW_TBL now
SET now.URLS = t.URLS
WHERE now.DESCR254 IN(
select t.PORTAL_URLTEXT from PSPRSMDEFN t, PS_Z_TREND_NOW_TBL trd
where t.VERSION =
(select MIN(t2.VERSION)
from PSPRSMDEFN t2
WHERE t2.PORTAL_LABEL = trd.DESCR254
AND t2.PORTAL_REFTYPE = 'C'
group by t2.PORTAL_LABEL
)
AND t.PORTAL_LABEL = trd.DESCR254
AND t.PORTAL_REFTYPE = 'C'
and t.PORTAL_NAME = 'EMPLOYEE'
)
This part of the query from above returns multiple rows of data. The values it returns are the same values in PS_Z_TREND_NOW_TBL.DESCR254. I want to match these values up with what is returned in the query to update the URLS field.
select t.PORTAL_URLTEXT from PSPRSMDEFN t, PS_Z_TREND_NOW_TBL trd
where t.VERSION =
(select MIN(t2.VERSION)
from PSPRSMDEFN t2
WHERE t2.PORTAL_LABEL = trd.DESCR254
AND t2.PORTAL_REFTYPE = 'C'
group by t2.PORTAL_LABEL
)
AND t.PORTAL_LABEL = trd.DESCR254
AND t.PORTAL_REFTYPE = 'C'
and t.PORTAL_NAME = 'EMPLOYEE'
t.version ininsteadt.version =