首页 \ 问答 \ Mysql子查询返回不正确的结果(Mysql subquery returns incorrect results)

Mysql子查询返回不正确的结果(Mysql subquery returns incorrect results)

我知道这是一个非常愚蠢的问题,相信我,我尝试了一切。 这是我的最后一招。

我正在尝试运行子查询。 令人惊讶的是mysql挂起(即使它不是一个大问题)。

我正在尝试运行此查询以返回一个Link_ids列表

    select distinct link_id from join_link_object where obj_id = (select group_concat(obj_id) from xalt_object where module_name like '%intel-compilers/2016.0.047%');

+---------+
| link_id |
+---------+
|  153249 |
+---------+

返回的结果不正确。 而不是返回link_id查询列表只返回第一个。

我知道使用=不是一个好主意,我尝试使用IN但提示只是挂起并且什么都不返回。

虽然单独运行子查询然后运行主查询及其结果会得到正确的结果(手动验证)。

mysql> select group_concat(obj_id) from xalt_object where module_name like '%intel-compilers/2016.0.047%';
+-------------------------------------------+
| group_concat(obj_id)                      |
+-------------------------------------------+
| 352304,352305,352306,352307,352308,354813 |
+-------------------------------------------+

然后运行主查询 -

mysql> select distinct link_id from join_link_object where obj_id in (352304,352305,352306,352307,352308,354813);
+---------+
| link_id |
+---------+
|  153249 |
|  153467 |
|  153996 |
|  154170 |
|  155077 |
|  155099 |
|  155100 |
+---------+

我甚至尝试使用EXISTS,但这些查询返回荒谬的结果(大约156995行) -

select distinct link_id from join_link_object where EXISTS  (select obj_id from xalt_object where module_name like '%intel-compilers/2016.0.047%');

请指教! 谢谢


I know this is a very stupid thing to ask, and believe me I tried everything. This is my last resort.

I am trying to run a subquery. Surprisingly mysql hangs (even though its not a big query).

I am trying to run this query to return me a list of Link_ids

    select distinct link_id from join_link_object where obj_id = (select group_concat(obj_id) from xalt_object where module_name like '%intel-compilers/2016.0.047%');

+---------+
| link_id |
+---------+
|  153249 |
+---------+

The result returned is not correct. Instead of returning the list of link_id query returns just the first one.

I know using = is not a good idea, I tried using IN but the prompt just hangs and returns nothing.

Although running subquery separately and then running the main query with its results gives correct results (verified manually).

mysql> select group_concat(obj_id) from xalt_object where module_name like '%intel-compilers/2016.0.047%';
+-------------------------------------------+
| group_concat(obj_id)                      |
+-------------------------------------------+
| 352304,352305,352306,352307,352308,354813 |
+-------------------------------------------+

then running main query -

mysql> select distinct link_id from join_link_object where obj_id in (352304,352305,352306,352307,352308,354813);
+---------+
| link_id |
+---------+
|  153249 |
|  153467 |
|  153996 |
|  154170 |
|  155077 |
|  155099 |
|  155100 |
+---------+

I even tried using EXISTS, but these query returns absurd results (around 156995 rows)-

select distinct link_id from join_link_object where EXISTS  (select obj_id from xalt_object where module_name like '%intel-compilers/2016.0.047%');

Please advice! Thanks


原文:https://stackoverflow.com/questions/33048726
更新时间:2022-05-27 20:05

最满意答案

编辑:您最好在调整大小时执行它。

$(window).bind("resize.preziresize", function() {
   $('div#prezi object')
       .find('embed')
       .andSelf()
       .attr( 'height' , $(window).height() )
       .attr( 'width' , $(window).width() );
}).trigger("resize.preziresize");

Edit: You should better execute it on resize too.

$(window).bind("resize.preziresize", function() {
   $('div#prezi object')
       .find('embed')
       .andSelf()
       .attr( 'height' , $(window).height() )
       .attr( 'width' , $(window).width() );
}).trigger("resize.preziresize");

相关问答

更多
  • 编辑:您最好在调整大小时执行它。 $(window).bind("resize.preziresize", function() { $('div#prezi object') .find('embed') .andSelf() .attr( 'height' , $(window).height() ) .attr( 'width' , $(window).width() ); }).trigger("resize.preziresize"); ...
  • 使用 $(".field img").attr("src", "images/dot.gif"); Use $(".field img").attr("src", "images/dot.gif");
  • 在标签和输入字段周围创建一个包装器Ember.View。 我们称之为App.FieldView : App.FieldView = Ember.View.extend({ tagName: 'fieldset' }); 然后在你的模板中: {{#each controller}} {{#view App.FieldView}}
  • 你误解了tkinter选项。 指定variable=data_contents类的属性时,它不会成为对象的属性。 相反,它是一个小部件配置选项。 要访问variable配置选项的值,您需要使用以下之一: self.radiobutton.cget("variable") self.radiobutton["variable"] 注意:你带着这个问题走错了路。 您无需获取变量,因为您可以控制变量。 该变量应该是一个实例属性,您可以在其上调用get()方法: ... self.data_contents = ...
  • 你可以做类似的事情,但我认为它没有多大意义 - 它很难维护。 您必须创建这个名称的外部列表,这些名称不会比您更好地命名错误。 相反,请考虑将您的javascript重写为更“封闭”。 而不是像$('#Name')那样使用全局搜索,而是将其范围限定为局部视图。 例如,如果您的局部视图看起来像这样:
    // ... other stuff ...
  • 要设置jQuery滑块的宽度,只需使用CSS将其包装在div和样式中。 您也可以通过CSS引用子元素来设置它们的样式,但这必须在渲染后使用jQuery完成。 例:
  • 你可以尝试这样的事情: var myID = '#' + myID; var elemClass=[]; $(myID).find('.some-class').each(function(){ if($(this).attr('data-att').length){ elemClass.push('custom-class--'+ $(this).attr('data-att')) ; } }); 并且请注意,您不能在代码中使用像class一样的reserved word ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。