Wouldn't
SELECT p.csymbol
FROM tblavgPrice p JOIN tblAssets a ON p.csymbol = a.csymbol
WHERE p.avg > 1 AND p.avg < 10
AND a.assets > 100 AND a.assets < 500
do what you want?
Michael
Chaitra Yale wrote:
...how can union be the same as intersect..iam trying to get the names
of comapnies that are in both queries.....for example the first query
gives me companies A, B AND C and the second query gives A , B..i want
the intersect of these 2 queries....so i get companies A and B...if i
did a union i will get A, B and C
On Wed, 3 Nov 2004 09:13:08 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Assuming you have access to MySQL 4.0+
select csymbol from tblavgPrice where avg > 1 and avg < 10
UNION
select csymbol from tblAssets where assets > 100 and assets < 500
Unless you say UNION ALL, you won't get duplicate values.
For more details: http://dev.mysql.com/doc/mysql/en/UNION.html
Just out of curiosity and because this is not the first time the INTERSECT
question has come up. What SQL dialect are you coming from?
IF you are using a MySQL server that is pre-4.0+, you will have to recode
that query using any of several variations that use a temporary table. Let
me know if you need that work-around.
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
Chaitra Yale <[EMAIL PROTECTED]> wrote on 11/03/2004 02:12:42 AM:
hi
i have a problem mysql doesnt seem to support the intersect can
somebody help how i can write the followoing code in mysql
select csymbol from tblavgPrice where avg > 1 and avg < 10
intersect
select csymbol from tblAssets where assets > 100 and assets < 500
thanks
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]