本文介绍了子查询多行如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 当我运行这个子查询时when I run this sub querySELECT bovd.CusCode, bovd.RecQty from BookOrdVehDetail bovd INNER JOIN VehicleSalesDetail vsd ON bovd.CusCode = vsd.CusCodeWHERE (SELECT sum(cast(bovd.Qty AS int)) From BookOrdVehDetail bovd Group By bovd.CusCode )>(select count(vsd.RecNo) New FROM VehicleSalesDetail vsd Group By Vsd.CusCode ) 错误此Error ThisMsg 512, Level 16, State 1, Line 1Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. 子查询1此图像中的结果和子查询2和结果此>>>>> >> http://postimg.org/image/8w2irf36p/ [ ^ ] http://postimg.org/image/vyt1ql4o1/ [ ^ ] http://postimg.org/image/p9miakjc1/ [ ^ ] i认为不应该有不止一行 im混淆了这是怎么来的..... 我该怎么做才能使这个查询 sum(Qty)>计数(发票)Subquery 1 Result in this image and Sub QUery 2 and Result this >>>>> >>http://postimg.org/image/8w2irf36p/[^]http://postimg.org/image/vyt1ql4o1/[^]http://postimg.org/image/p9miakjc1/[^] i think there is more than one row should not comei m confuse how this is come there.....And what should i do for make this query sum(Qty) > Count(invoice)推荐答案试试这个...try this...SELECT bovd.CusCode, bovd.RecQty from BookOrdVehDetail bovd INNER JOIN VehicleSalesDetail vsd ON bovd.CusCode = vsd.CusCodeWHERE (SELECT sum(cast(bovd1.Qty AS int)) From BookOrdVehDetail bovd1 Group By bovd1.CusCode having bovd.CusCode=bovd1.CusCode)>(select count(vsd1.RecNo) New FROM VehicleSalesDetail vsd1 Group By Vsd1.CusCode having vsd1.CusCode=vsd.CusCode) 快乐编码! :)Happy Coding!:)试试这个querry之后通过..........删除组nd在尝试try this querry after removing group by .......... nd do tell me the result after trying 这篇关于子查询多行如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-18 20:55