从两个不完全匹配的表中获取数据 [英] Getting data from two tables that are not exact matches

查看:69
本文介绍了从两个不完全匹配的表中获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的售票系统上生成负载分析报告。它是由白天驱动的。



在任何一天,我都可以进行验证和信用旅程,单独验证或单独信用旅程。



如果我通过Validations驾驶,我可以使用左连接来获取任何有信用旅程的日子以及所有实际目的,即真实世界的概率。



但是我想扩展我的查询以涵盖一天可能会看到信用旅程但没有验证的可能性!



表格是MySQL数据库和数据将采取的形式

I need to produce a load analysis report on my ticketing system. It is driven by day.

On any given day I can have Validations and credit journeys, validations alone or credit journeys alone.

If I drive by Validations I can use a left join to pick up any days that have credit journeys and to all practical purposes that is the real world probability.

However I would like to expand my query to also cover the possibility that a day might see credit journeys but no validations!

The tables are on a MySQL database and the data will take the form

T1-----T2
---  ---
A-----
B-----B
-----C
D-----
E-----E



我看过联盟,但我认为不正确。



有什么想法吗?


I have looked at Union but I don't think its correct.

Any thoughts?

推荐答案




select *来自T1

除了

从T2选择*
Hi
select * from T1
Except
select * from T2


这篇关于从两个不完全匹配的表中获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆