联合/合并多个查询! [英] Union/Merge more than one query !

查看:57
本文介绍了联合/合并多个查询!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我如何合并几个已经联合的quries的结果?


例如:

Hi

How can I merge the result of few quries that had been unioned ?

example:

展开 | 选择 | Wrap | 行号

推荐答案

Heya,coool。欢迎来到TSDN!


发布源代码时请使用CODE标签。请在下次发布时查看页面右侧的REPLY GUIDELINES。


我认为你要做的就是加入你的桌子:
Heya, coool. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

I think what you are trying to do is join your tables:
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


感谢您建议我使用标签的好方法.. :)


do你认为你编写的mysql代码会给出我上面写的mysql代码的相同结果吗?


如果你向我解释你的代码在做什么,我可以判断这是不是我正在寻找的......会哟请你这样做吗?


提前谢谢,


库里:))
Thanks for the nice way you''ve advised me to use the tags.. :)

do you think the mysql code you''ve wrote will give the same result of the mysql code I''ve written above ?

maybe if you explained for me what your code is doing, I can tell if that''s really what I''m looking for.. will you do that please ?

thanks in advance,

coool :)


Heya,coool 。


我不完全确定你想要完成什么。


使用UNION关键字的好处是它允许您为多个查询返回单个结果集。这样做的问题在于它本质上只是三个不相互交谈的单独查询。


在我之前的帖子中提供了一个连接的例子解决问题的一种方法。它与使用UNION关键字不同,因为它不是运行三个单独的查询,而是在所有三个表中运行一个查询以查找类似的记录。


然而,乍一看,你可能会发现使用子查询更有用:

Heya, coool.

I''m not entirely certain what you''re trying to accomplish.

The nice thing about using the UNION keyword is that it allows you to return a single result set for multiple queries. The issue with doing it this way is that it is in essence just three separate queries that don''t talk to each other.

In my previous post provided an example of a join as one way to approach the situation. It''s different than using the UNION keyword because instead of running three separate queries, it runs one query across all three tables looking for similar records.

However, at second glance, you might find it more useful just to use a subquery:

展开 | 选择 | Wrap | 行号


这篇关于联合/合并多个查询!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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