Re: selecting rows tagged with "a" but not "b"

Поиск
Список
Период
Сортировка
Искать
От
Milen A. Radev
Тема
Re: selecting rows tagged with "a" but not "b"
Дата
Msg-id
4B66DD75.5010506@radev.net
Ответ на
selecting rows tagged with "a" but not "b" (8q5tmkyqry@sneakemail.com)
Список
Дерево обсуждения
Re: selecting rows tagged with "a" but not "b" "Oliveiros C," <oliveiros.cristina@marktest.pt>
8q5tmkyqry@sneakemail.com написа:
> Hi,
> 
> I have a two tables:
> 
> article
> articleID, name, content
> 
> tags
> articleID, tag
> 
> I want to find all articles that are tagged with "a" but not "b"
> 
> how do I do this?
> 
> what I'd like to do is:
> 
> 
> select articleID from tags where tag="a"
> SUBTRACT
> select articleID from tags where tab="b"
> 
> 
> how do I do this in real SQL?

Replace "SUBSTRACT" with "EXCEPT" 
(http://www.postgresql.org/docs/current/static/sql-select.html#SQL-EXCEPT).




-- 
Milen A. Radev

В списке pgsql-sql по дате отправления
От: 8q5tmkyqry@sneakemail.com
Дата:
От: Oliveiros C,
Дата:
FAQ