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 sugested solutions return me A, B (and doesn't return 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]



Reply via email to