mysql - Subquery returns more than 1 row solution for update query using select statement -
mysql - Subquery returns more than 1 row solution for update query using select statement -
hello have query in have written update statement using select statement. unfortunately getting errors subquery returns more 1 row. know error coming. dont know solution same.thank you. here query:
update adsetest.dashboard_widget_users set configuration= (select distinct ad_news_texte.headline autodo.ad_news_texte inner bring together autodo.ad_news_oe on ad_news_texte.news_id = ad_news_oe.id_ad_news inner bring together autodo.ad_news on ad_news_oe.id_ad_news = ad_news.id ad_news.datum_archiv between curdate() - interval dayofweek(curdate()) + 28 day , curdate()) dsnr_yw_user = 1 , dsnr_dashboard_widget = 1
when utilize update set configuration=(select ...)
subquery has homecoming no more 1 value (one row). if returns more 1 value how assign 2 rows table illustration scalar configuration
field. should figure out why subquery returns more 1 row , prepare subquery or decide 1 value select update in case of more 1 row. illustration can select maximum value
select max(ad_news_texte.headline)...
or 1 first value
(select ad_news_texte.headline)... limit 1)
and on...
if need concatenate rows , set 1 row configureation
can utilize group_concat() mysql function:
set configuration=(select group_concat(distinct ad_news_texte.headline) ....
mysql sql sql-update subquery
Comments
Post a Comment