- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的数据库中有两个表:
1. venprices
+---------+---------+--------+
| concode | rate | vendor |
+---------+---------+--------+
| 1234 | 1.23402 | a |
| 1234 | 1.5692 | b |
| 1234 | 1.114 | c |
| 1234 | 1.4 | d |
| 1122 | 1.46 | a |
| 1122 | 1.5 | c |
| 1122 | 1.2 | d |
+---------+---------+--------+
2. country
+-------+---------+
| conid | conname |
+-------+---------+
| 1122 | con2 |
| 1234 | con1 |
+-------+---------+
我想要这样的输出:
+---------+---------+-------------+--------+
| concode | conname | MIN(v.rate) | vendor |
+---------+---------+-------------+--------+
| 1122 | con2 | 1.2 | d |
| 1234 | con1 | 1.114 | c |
+---------+---------+-------------+--------+
我正在使用查询:SELECT v.concode,c.conname, MIN(v.rate), v.vendor FROM venprices v, country c WHERE c.conid = v.concode GROUP BY c.conid;
查询给出了结果,但供应商名称错误。它不是提供与供应商相关的费率,而是总是在结果中给我供应商 a
。
我已经尝试过不同的子句和子查询,但都没有成功。有人可以告诉我实际问题和产生所需结果的查询吗?
最佳答案
你可以使用 suquery
select v.concode,c.conname, v.rate, v.vendor
FROM venprices v
inner join country c on c.conid = v.concode
where (v.concode, v.rate) in ( select v.concode, min(v.rate)
from venprices v
group by v.concode)
如果没有与'concode'相关的'conid',则可以使用LEFT JOIN
select v.concode,c.conname, v.rate, v.vendor
FROM venprices v
left join country c on c.conid = v.concode
where (v.concode, v.rate) in ( select v.concode, min(v.rate)
from venprices v
group by v.concode)
关于MySQL : selecting minimum value from one table and country details from another and grouping them according to country code,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39439650/
这是我的代码。 1 Demo 1 2 Demo 2 3 Demo 3 我想做的是——如果任何一个的细节标签已打开,我打开/查看另一个 标签,那么较早的标签应该关闭/
我正在尝试构建一个 iPad Master-Detail 应用程序。主视图只是一个 TableViewController。我想为用户在主视图中点击的每个不同单元格更改完整的详细信息 View 。其中
我目前在我的子主题的 functions.php 文件中有一些代码,它应该在我的 WooCommerce 结帐页面上将“账单详细信息”更改为“运输详细信息”。 但是,当我更新到 WooCommerce
我想刷新 MasterDetail 项目中的详细信息页面。 (在模态 Controller 中进行编辑后应刷新详细信息。)我知道将代码块放在详细信息页面中的何处以强制刷新。我只是不知道要使用什么代码来
我的应用程序中有一个主从模式,但我希望细节能够切换 View 。我想尽可能多地节省空间,以便“内容”既漂亮又宽敞。 如何从一个“细节”导航到另一个“细节”,同时让“向上”按钮返回“主”列表?(参见“细
在过去,我有一个包含这样一个表的数据库: ProductID | ProductName | InStockWareHouse1 | InstockWareHouse2 ---------------
boost::details::pool::pthread_mutex 和 boost::details::pool::null_mutex 有什么区别。 我看到在最新的 boost 版本 - 1.4
我只获取数据源的详细信息,但没有获取 google fit 消耗的卡路里。如何获得燃烧卡路里的详细信息。我可以从( Google Fitness API returns only {} as resu
我刚刚在 Xcode 5 中创建了一个新的“Master-Detail application”项目。 然后在我的主视图 Controller 上,我将 TableView 更改为静态,并添加了一些项
我试图在“me”/me 部分下命名多个路由,以便在此命名空间下拥有所有基于用户配置文件/帐户的内容,以实现更干净的路由。 解决这个问题的最佳方法是什么?我发现重写默认的 REST 路由(profile
所以我是 Android 开发的新手,并试图了解主/细节流程设计。因此,我使用 Eclipse 为您创建的默认类 - 因此 ScreenDetailActivity、ScreenDetailFragm
我使用 var contacts:[details] 编写代码? = nil 我遇到了无法访问 contacts?.count 的问题,我不得不在任何地方使用可选值。例如 contacts[index
我已经成功地将 www.my-website/blog.php 重写为 www.my-website/blog 现在,我想对我的 blog-detail.php 页面做进一步的事情 从 www.my-
在问这个问题之前,我想说 this stackoverflow 中的问题与我的问题非常相似,但概念仍然不清楚,非常困惑。 我想了解依赖倒置原则,但我无法完全理解它? 下面是DIP说的两点 A. Hig
我是 SYCL/OpenCL/GPGPU 的新手。我正在尝试构建和运行常量加法程序的示例代码, #include #include #include #include namespace sy
我正在使用这个 Ray Wenderlich tutorial作为我正在从事的项目的指南。但是,我正在尝试扩展此模板以合并子目录、子子目录、子子子目录等。 例如,如果您单击主/主目录屏幕中的“Cand
我正在尝试创建一个小扩展,以便我可以从详细 View Controller 访问主视图 Controller 以更新变量。 import UIKit extension UISplitViewCont
我正在尝试基于由 MySQL 数据库支持的 Entity Framework 6 DbContext 实现基本的主从 View 。表格配置尽可能简单: 我的测试应用程序的表单包含两个 ComboBox
我知道这是一个老问题并且已经answered在 objective-c 中。但我正在寻找 Swift 中的解决方案。我在 AppDelegate 中的 splitviewController 代码如下
我的句子很少。在第一句话的结尾(在这一行),我想添加剧透,这将保留故事的其他部分。我正在尝试这样做,但是当单击更多时.. - 我的文本跳到下一行。我需要在一行中继续文本更多...请不要告诉我任何脚本,
我是一名优秀的程序员,十分优秀!