[英]Column loop and update another column with COUNT() value from another table
[英]Select max of count from a table and update another column
我需要从col1_class列的Count中找到最大值,并使用我尝试此代码的值更新table2列“ lbl1”,但出现错误:
update testClassLable
set lbl1 = (
select max(maxVal)
from (
select count (col1_class) as maxVal
from tbl_test_all
group by col1_class
)x
)
你能帮忙吗?
*更新*
我编辑了上面的代码,现在开始工作,但返回:
0行受到影响!
尝试这个
update testClassLable
set lbl1 = (
select max(countVal)
from (
select count(col1_class) as countVal
from tbl_test_all
group by col1_class
) x
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.