List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:December 1 2008 7:25pm
Subject:Re: Intersect question
View as plain text  
 > The task is to perform an intersection on 'name' column according to 
all distinct values in 'study' column.

Did you try ...

SELECT DISTINCT a.symbol
FROM test as a
JOIN test as b ON a.symbol=b.symbol
WHERE a.study <> b.study;

PB

-----

Andrej Kastrin wrote:
> I have the table 'test' which includes two columns: 'study' and 'symbol':
>
> study symbol
> a2008 A
> a2008 B
> a2008 C
> a2008 D
> b2005 A
> b2005 B
> b2005 E
>
>
> The task is to perform an intersection on 'name' column according to 
> all distinct values in 'study' column. During the experiments the 
> intersection was done 'manually' using the query:
>
> SELECT a.symbol FROM test as a, test as b WHERE a.symbol=b.symbol and 
> a.study="a2008" and b.study="b2005";
>
> So the result of the query above is (A, B).
>
> The question is how to implement this query more automatically, 
> without directly referencing to the study names, because I want to 
> implement it into a php script.
>
> Thank you in advance for any suggestions.
>
> Best, Andrej
>
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com 
> Version: 8.0.176 / Virus Database: 270.9.11/1820 - Release Date: 11/29/2008 6:52 PM
>
>   

Thread
Intersect questionAndrej Kastrin1 Dec
  • Re: Intersect questionMicah Stevens1 Dec
    • MySQl and LVMShain Miley1 Dec
      • Re: MySQl and LVMSimon J Mudd2 Dec
        • Re: MySQl and LVMShain Miley2 Dec
    • RE: Intersect questionRolando Edwards1 Dec
  • Re: Intersect questionMicah Stevens1 Dec
  • Re: Intersect questionPeter Brawley1 Dec