子查询返回多行MySQL(Subquery returns more than 1 row MySQL)
嘿所以有这两个表名称和代码,我试图创建一个包含所有名称的表,并将每个现有代码与名称相匹配。 某些名称没有代码,因此它们应显示为NULL。 无论如何这是我的代码:
SELECT company.name, (SELECT companyclassification.code FROM insure_prod.companyclassification WHERE company.OIQ_ID = companyclassification.ussicClassification_StdCompany) AS USSIC_Code FROM insure_prod.company
当我尝试运行它时,它显示错误代码:1242子查询返回超过1行
提前致谢
Hey so there are these two tables Name and Code and I am trying to make a table with all the Names and match each existing code to the names. Some Names do not have codes so it should display as NULL for those ones. Anyways this is my code:
SELECT company.name, (SELECT companyclassification.code FROM insure_prod.companyclassification WHERE company.OIQ_ID = companyclassification.ussicClassification_StdCompany) AS USSIC_Code FROM insure_prod.company
When I try to run this it displays Error Code: 1242 Subquery returns more than 1 row
Thanks in advance
原文:https://stackoverflow.com/questions/17477398
满意答案
检查您是否未将项目与自身进行比较。 还不清楚
itemNo
来自哪里; 它应该是self.items
之一的self.items
。 此外,您的名字有点落后:newItem
实际上是要比较的现有项目。因此,如果新项目是
newItem
,您的比较可能如下所示:var match = ko.utils.arrayFirst(self.items(), function(oldItem) { return newItem !== oldItem && newItem.itemNo() === oldItem.itemNo(); });
Check that you are not comparing an item to itself. It's not clear where
itemNo
comes from; it should be a member of one ofself.items
. Also, your names are somewhat backward:newItem
is really the existing item being compared.So if the new item is
newItem
, your compare might look like:var match = ko.utils.arrayFirst(self.items(), function(oldItem) { return newItem !== oldItem && newItem.itemNo() === oldItem.itemNo(); });
相关问答
更多KnockoutJS如何知道项目在数组中被“移动”的时间?(How does KnockoutJS know when an item is 'moved' in an array?)
更新KnockoutJS关联observableArray值(Updating KnockoutJS associative observableArray values)
Knockoutjs attr点击(Knockoutjs attr with click)
knockoutjs订阅不工作?(knockoutjs subscribe not working?)
使用Knockoutjs和jCarouselLite(Working with Knockoutjs and jCarouselLite)
numpy.any()返回True,但“是True”比较失败[duplicate](numpy.any() returns True but “is True” comparison fails [duplicate])
KnockoutJS和无限循环[重复](KnockoutJS and Infinite Loop [duplicate])
knockoutjs:克隆一个observableArray-Object(knockoutjs: cloning an observableArray-Object)
Knockoutjs将observableArray绑定到byte(Knockoutjs bind an observableArray to byte)
knockoutjs - 检查数组中是否存在项目总是返回true [duplicate](knockoutjs - checking if item exists in array always returns true [duplicate])
相关文章
更多Solr与Mysql集成指南
Solr与Mysql集成指南
mysql问题
关于netbeans和mysql的问题
MySQL高级视频教程
关于mysql 的 sql
MySQL正则查询问题!
mysql in根据查询id排序
6个常用的Mysql字符串连接函数
最新问答
更多您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
在计算机拍照在哪里进入
使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
单页应用程序:页面重新加载(Single Page Application: page reload)
在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!