On 12/01/2008 08:30 AM, 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
>
Why not:

SELECT a.symbol FROM test as a, test as b WHERE a.symbol=b.symbol and
a.study != b.study group by symbol;


-Micah

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to