将 INTERSECT 语句转换为 MySQL
我使用 INTERSECT 有以下查询,但我不知道如何使用 INNER JOIN 将其转换为 MySQL。
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location1' AND Date='Date1'
INTERSECT
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location2' AND Date='Date2'
INTERSECT
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location3' AND Date='Date3'
有人可以帮我吗?
I have the following query using INTERSECT and I can't figure out how to translate it to MySQL using INNER JOIN.
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location1' AND Date='Date1'
INTERSECT
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location2' AND Date='Date2'
INTERSECT
SELECT DISTINCT Title, Variable FROM Table WHERE Location='Location3' AND Date='Date3'
Can anyone give me a hand?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要使用 SELECT DISTINCT ,但我无法判断,因为我不知道您的表结构、唯一约束等。
回复您的神秘评论:我在测试数据库中尝试了以下脚本:
输出是这样的:
You might need to use
SELECT DISTINCT
but I can't tell because I don't know your table structure, unique constraints, etc.Re your cryptic comment: I tried the following script in my test database:
The output is this: