Something like:
select * from table as t1, table as t2 where
t1.study=t2.study and
t1.keyword = 'K1' and not
t2.keyword ='K2'
Santino
At 11:57 -0800 8-11-2004, L a n a wrote:
Hello,
I've had a problem:
statement "SELECT data_id from table WHERE keyword = a NOT keyword
= b" returns SQL error
I've got the following not working solutions to my problem:
SELECT data_id FROM table WHERE keyword = a AND keyword <>(or !=) b
SELECT data_id FROM table WHERE keyword = a AND NOT (or OR NOT) keyword = b
To explain better what result I need to get, there is table
Id Study keyword
1 A K1
2 A K2
3 B K1
4 B K2
5 C K1
6 C k3
I need to return study C, because it has only K1 keyword. However,
all the suggested solutions return me A, B, C in the following order:
if I ask for K1/K2 then it returns studies A, B;
if I ask for K2/K1 (order matters) then it returns A, B, C.
How to solve the problem?
I tried "SELECT T.data_id from table T WHERE T.keyword = a EXCEPT
SELECT T2.data_id from table T2 WHERE T2.keyword =b" . But it gives
SQL error.
Any thoughts?
Thank you,
Lana
--
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]