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

This makes no sense. You have no column named data_id. You have no columns named a or b. You have no no keywords that have a value of 'a' or 'b'. What exactly are you trying to do?



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)

They could not possibly be returning these values, since you don't select Study in any of the above queries.




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

Show what you really have in your tables, your queries, and what is actually returned.
Then explain what you wanted.
Post ONLY to the list.







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



Reply via email to