Mike Spreitzer wrote:
I'm not sure whether the following will meet your needs. Have you
considered
SELECT title FROM Title WHERE NOT EXISTS (SELECT * FROM Keyword,
TitleKeyword WHERE Keyword.kw='A' AND Keyword.id=TitleKeyword.keyword_id
AND TitleKeyword.title_id=Title.id)
I believe you are
I have a database of Titles (books, magazines, etc.) with a M:M relation
to Keywords.
I would like to be able to generate queries for the condition Return
titles matching X with keywords NOT matching A.
This seems quite hard to do. Here is a minimal table structure:
CREATE TABLE Title
(
...@us.ibm.com, Lotus Notes: Mike Spreitzer/Watson/IBM
Office phone: +1-914-784-6424 (IBM T/L 863-)
AOL Instant Messaging: M1k3Sprtzr
James Fryer j...@invocrown.com
09/24/09 06:42 AM
To
mysql@lists.mysql.com
cc
Subject
Excluding records that don't match condition
I have a database of Titles
If I've got the following two tables:
CREATE TABLE password_log (
time_stamp int(11) unsigned NOT NULL default '0',
remote_host char(15) NOT NULL default '',
remote_user char(50) NOT NULL default '',
status smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY
I guess you need something like
SELECT * FROM password_log t1 LEFT OUTER JOIN exclude_log t2 ON
t1.remote_host=t2.ip_block WHERE t2.ip_block IS NULL;
I am just guessing that both tables are related through remote_host and
ip_block,
Adolfo
On Thu, 2002-12-19 at 17:31, Eric Anderson wrote:
If
Then this should work.
SELECT remote_user, substring_index(remote_host,'.',3)
AS ip_subnet
FROM password_log LEFT JOIN exclude_log ON
substring_index(password_log.remote_host,'.',3) =
exclude_log.ip_block
WHERE remote_user != '-' AND status=200 AND
ip_block IS NULL
GROUP BY ip_subnet
ORDER BY