Get the App
SLTechnology News&Howtos  ›  Database  › 

How to output the results of several select statements together by SQL

Shulou Source: shulou.com Published: 2022-05-31 18:55:54 09月10日 Update

The main content of this article is to explain "SQL how to put the results of several select statements together to output", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "SQL how to put the results of several select statements together to output"!

This can be achieved using CROSS JOIN.

For example, there are two tables, Table1 and Table2, associated with an item of Table3 and Table4, respectively. To output the associated data of Table1 and Table2 to a Select statement at the same time, you can:

SELECT * FROM

(

(SELECT t1.sn FROM Table1 T1 Table3 T3 WHERE t1.sn=t3.sn) t1Info

CROSS JOIN

(SELECT t2.sn FROM Table2 T2 Table4 T4 WHERE t2.sn=t4.sn) t2Info

)

At this point, I believe you have a deeper understanding of "SQL how to put the results of several select statements together to output". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Statement output result content relevance learning practical deeper two interest at the same time practical practical easy to operate data methods more friends websites channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Huawei Redmi macOS OPPO Reno