|
|
|
|
|
|
| Author |
Message |
David Kerber *nix forums beginner
Joined: 18 May 2005
Posts: 40
|
Posted: Tue Apr 05, 2005 9:35 am Post subject:
Re: An example of using intersection between two tables
|
|
|
In article <1112677195.992132.135910@g14g2000cwa.googlegroups.com>,
zeldorblat@gmail.com says...
| Quote: | Intersect simply returns the rows that are the same from two different
queries. For example, consider the following:
Table Store_Information
store_name Sales Date
Los Angeles $1500 Jan-05-1999
San Diego $250 Jan-07-1999
Los Angeles $300 Jan-08-1999
Boston $700 Jan-08-1999
Table Internet Sales
Date Sales
Jan-07-1999 $250
Jan-10-1999 $535
Jan-11-1999 $320
Jan-12-1999 $750
and we want to find out all the dates where there are both store sales
and internet sales. To do so, we use the following SQL statement:
SELECT Date FROM Store_Information
INTERSECT
SELECT Date FROM Internet_Sales
Result:
Date
Jan-07-1999
|
That is essentially an INNER JOIN.
--
Remove the ns_ from if replying by e-mail (but keep posts in the
newsgroups if possible). |
|
| Back to top |
|
 |
ZeldorBlat *nix forums Guru Wannabe
Joined: 01 Mar 2005
Posts: 272
|
Posted: Tue Apr 05, 2005 3:01 am Post subject:
Re: An example of using intersection between two tables
|
|
|
Intersect simply returns the rows that are the same from two different
queries. For example, consider the following:
Table Store_Information
store_name Sales Date
Los Angeles $1500 Jan-05-1999
San Diego $250 Jan-07-1999
Los Angeles $300 Jan-08-1999
Boston $700 Jan-08-1999
Table Internet Sales
Date Sales
Jan-07-1999 $250
Jan-10-1999 $535
Jan-11-1999 $320
Jan-12-1999 $750
and we want to find out all the dates where there are both store sales
and internet sales. To do so, we use the following SQL statement:
SELECT Date FROM Store_Information
INTERSECT
SELECT Date FROM Internet_Sales
Result:
Date
Jan-07-1999
Let it be known to all that I ripped this off from:
http://www.1keydata.com/sql/sql-intersect.htm
(the very first result in a Google search for "sql intersect") |
|
| Back to top |
|
 |
amos_s12@zahav.net.il *nix forums beginner
Joined: 27 Mar 2005
Posts: 3
|
Posted: Mon Apr 04, 2005 6:13 pm Post subject:
An example of using intersection between two tables
|
|
|
Hello
Can somebody can write an example of using the intersection operation between
two tables.
The example will be very helpful to me in writing some of my store procedures
Thanks ahead
Amos |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Jan 08, 2009 4:26 am | All times are GMT
|
|
Wide Shoes for Women & Men | Mortgage Loans | Debt Consolidation | Loans | Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|