- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下关系表,按关系描述为:
Table product(id(PK),name,type(FK),category(FK),brand(FK));
Table Specification (id(PK),name);
Table product_specification_m2m (id(PK),specification(FK),value);
Table speclist (id(PK),specification(FK),product_type(FK),listtype);
对产品运行此查询会带来预期的结果:
select m2m.specification,sl.product_type,sl.listtype
from product_specification_m2m m2m
left join specification s on
s.id = m2m.specification
left join speclist sl on
sl.specification = m2m.specification
where m2m.product=626 and sl.product_type=8 and listtype="short";
+---------------+--------------+----------+
| specification | product_type | listtype |
+---------------+--------------+----------+
| 98 | 8 | short |
| 100 | 8 | short |
+---------------+--------------+----------+
2 rows in set (0.00 sec)
但是对于 product_type=8 的任何其他产品,运行此查询会带来一个空数组! :
select m2m.specification,sl.product_type,sl.listtype
from product_specification_m2m m2m
left join specification s on
s.id = m2m.specification
left join speclist sl on
sl.specification = m2m.specification
where m2m.product=471 and sl.product_type=8 and listtype="short";
0 rows in set (0.00 sec)
For listtype="long" it mysteriously brings :
+---------------+--------------+----------+
| specification | product_type | listtype |
+---------------+--------------+----------+
| 135 | 8 | long |
+---------------+--------------+----------+
1 rows in set (0.00 sec)
谁能帮我指出其中的奥秘(或者我太笨了,花了3个小时也找不到它!)在这里!
编辑:
speclist 表采用一些规范并将它们分类为“短”列表和“长”列表。这就是我在网页上显示它们的方式。入围名单保留 2/3 个规范 ID,长名单通常保留 9/10 个规范 ID。
再次突出显示内容:
每种产品类型都有一组规范。
每个产品都有该类型规范的子集(产品和规范所属)
每个产品同样有两个规范子集,在规范表中按“短”和“长”分类。
最佳答案
从 WHERE 子句中排除 m2m.product=471 并检查符合该条件的产品:sl.product_type=8 和 listtype="short"
你写道“listtype="long"它神秘地带来了”一个记录。这并不神秘。您查找产品 471,并花费 listtype="long" 获得该产品,那么为什么您想要花费 listtype="short" 获得该产品呢?我假设这个 listtype
中不存在它关于mysql - 一个神秘的 MySQL 选择查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24465989/
我正在尝试更新我的 jtable(更改值并按 Enter 键),但出现错误。由于大小原因,错误未完整。我认为其余部分只是 c3p0 池连接工具生成的不相关信息。 假设 起初,我认为这可能是 c3p0
每当我有两个水平并排的元素并指定了右和/或左填充和/或边距时,元素之间通常会在我指定的上方和上方有空格。我希望有人能告诉我如何消除该空间(没有像负边距这样的笨拙东西)。 请注意:我并不是在寻找替代的多
String[] parts = msg.split(" +\n?"); String room = parts[0]; System.out.println(msg); Sy
我知道“一定有什么东西被改变了”,但我的代码似乎在一夜之间无缘无故地崩溃了。 我的服务器目录结构是这样的: / /scripts /audit /other_things 我在“scripts”文件夹
我正在尝试了解 GCM 的工作原理。为此,我复制/粘贴 http://developer.android.com/ 的代码在“实现 GCM 客户端”部分中提出。 从服务器发送消息是可行的,但是当我的客
在生成随机整数时,我发现了一些有趣的事情(至少对我而言),我无法向自己解释,所以我想我会把它贴在这里。 我的需求很简单:我要生成随机积分 (Int32) ID 并旨在最大程度地减少冲突。生成时间不是问
在这里https://stackoverflow.com/a/19915925/4673197我了解到我可以通过设置 IFS 将字符串拆分为数组。 在这里https://stackoverflow.c
我现在正在为我的 CS 测试学习,并尝试编写代码,以明文形式给出整个 IMDB 数据库,找到电影中共同点最多的 Actor 。我已经差不多完成了,只是不断遇到一个奇怪的 KeyError。这是我的代码
在 Android 平台上开发了几个月之后,我仍然有一个悬而未决的问题。很久以前,我注意到我有一个 Activity 不符合应用程序主题的其余部分。这意味着默认情况下,Activity 的字体颜色是白
本周,我注意到我的团队 Azure 门户上有一个持续的网络作业。 团队中没有人表示他们已经部署了它,或者熟悉它。我找到了这个博客: https://azure.microsoft.com/en-ca/
所以我正在制作一个小型闲置游戏,我的部分努力是格式化所有数字,以便它们之间有逗号(出于美观目的)。我成功地让我的货币 Energy 带有这些逗号,但我很难添加其他变量。我用了num.toLocaleS
我遇到了一个我以前从未见过的奇怪问题,我认为它一定是一些我在代码中没有看到的简单问题。 我有一个项目,其中定义了 2 个 Windows 服务。一个我称为 DataSyncService,另一个称为
我有这个jsfiddle一次有效。 function toggle_off(itemID){ alert(itemID+'->'+document.getElementById(itemID).g
更新:已解决,我是白痴,谢谢大家! Okay little bit weird.. I just created a layout file for list items, I can see it
问题:这段代码究竟在做什么? 另外:“w”的使用方式是否是某种现有算法?我试图弄清楚函数的意图,或者至少描述它产生的数字种类。 上下文:我正在查看 Martin O'Leary 的“Fantasy M
你能帮帮我吗?我正在将自己传递给它自己的纯虚函数。 n->dataCallback(handler, n, hangup); 其中 n 是我的类指针,dataCallback 是它自己的(纯)虚函数(
我知道这里有数百万篇关于这个异常(exception)的帖子,但我不明白这里的这个。我有一个极端简单的示例管道服务: [ServiceContract] public interface ISRARi
此代码有效,但它如何不实际调用任何列出的方法。它有效,但它的工作原理和原因似乎几乎是神奇的。我实际上从未调用过 Equals、GetHashCode 或 Compare,但代码有效。我也从不在实现两个
警告: Element 'TextStyle' from SDK library 'ui.dart' is implicitly hidden by 'text_style.dart'. 代码摘录:
我有一个似乎无法解开的谜。我有这个非常简单的单元测试,它使用了一个非常简单的自定义属性。该属性仅添加到甚至未实例化的 1 个类。我计算属性被构建的次数。由于类 MyDummyClass 上的属性,我希
我是一名优秀的程序员,十分优秀!