SQL > SQL????? > Union

UNION?????? ??? SQL ??? ??? ????????. ? ??? ?? UNION ? JOIN ? ??? ?? ????. ??? ? ? ????? ?? ???? ??? ?? ???? ???? ??? ????. UNION? ??? ??? SQL??? ??? ??? ?? ??? ???? ??? ????. ??? ??? UNION ?????? ???? ??? ????(SELECT DISTINCT ? ???)? ?? ????.

UNION ? ??? ??? ????:

[SQL ?? 1]
UNION
[SQL ?? 2];

?? ??? ??? ??? ????,

Store_Information ??
Store_NameSalesTxn_Date
Los Angeles150005-Jan-1999
San Diego25007-Jan-1999
Los Angeles30008-Jan-1999
Boston70008-Jan-1999

Internet_Sales ??
Txn_DateSales
07-Jan-1999250
10-Jan-1999535
11-Jan-1999320
12-Jan-1999750

??? ?? ??? (sales) ? ??? ??? ???. ? ??? ???? ?????? SQL??? ?????:

SELECT Txn_Date FROM Store_Information
UNION
SELECT Txn_Date FROM Internet_Sales;

??:

Txn_Date
05-Jan-1999
07-Jan-1999
08-Jan-1999
10-Jan-1999
11-Jan-1999
12-Jan-1999

????? ?? ??? SQL??(?? ????)?? "SELECT DISTINCT Txn_Date" ? ????? ??? ?? ??? ??? ??? ????.

SQL UNION ALL >>
?


Copyright © 2021   1keydata.com   All Rights Reserved