Hi,

I'm building a planning system for a newspaper. Article ideas are defined as articles with no deadline, no publication date or no reporter assigned. I wan't to show all entries from table un_article that matches those three criterias.

I have three tables:

CREATE TABLE un_article
(
a_id INT PRIMARY KEY AUTO_INCREMENT,
a_header VARCHAR(20),
a_editor INT,
a_section INT,
a_deadline DATE DEFAULT "0000-00-00",
a_issue DATE DEFAULT "0000-00-00",
a_ready ENUM("Y","N" ) DEFAULT "N",
a_picture ENUM("N","B","G","R","F" ) DEFAULT "N",
a_desc MEDIUMTEXT
);

CREATE TABLE un_section
(
s_id INT PRIMARY KEY AUTO_INCREMENT,
s_name VARCHAR(40),
UNIQUE (s_name)
);

CREATE TABLE un_article_writer
(
a_id INT NOT NULL,
u_id INT NOT NULL,
PRIMARY KEY (a_id, u_id)
);

I want to get un_article.a_id, un_article.a_header and un_section.s_name for the entries in un_article for which un_section.s_id = un_article.a_section, un_article.a_deadline = '0000-00-00' and un_article.a_issue = '0000-00-00' and also only for entries in un_article whose un_article.a_id doesn't match a un_article_writer.a_id.

But I'm not able to build this query. I have tried various variants of the following, without any success.

"SELECT un_article.a_id, un_article.a_header, un_section.s_name FROM un_article, un_section, un_article_writer WHERE un_article.a_id != un_article_writer.a_id AND un_section.s_id = un_article.a_section AND un_article.a_deadline = '0000-00-00' AND un_article.a_issue = '0000-00-00' ORDER BY un_section.s_name ASC, un_article.a_header ASC"

Help appreciated! :)

--
anders thoresson

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



Reply via email to