I am currently writing a MySQL,
Tomcat app and have some serious problems
figuring out a MySQL query. I know this is probably not the right place to
ask, since it focuses on
java - but still it would be nice if somebody could
help me out here.
Suppose you have a table called testdata that looks like this:
and has the following data:
How do you manage to form a select that picks all field_ids that NEVER have the ref_id = 2?
In the above example my desired query would return my second field_id only (and only once),
because field_id=1 has one entry where it has ref_id=2.
I tried:
select distinct field_id,ref_id from
test where ref_id not in (2)
and some similar queries with EXISTS and such...bot wasn't able to make it happen that way. Help me - please

[ June 28, 2005: Message edited by: James Watson ]