[GENERAL] SELECT statement with sub-queries

Поиск
Список
Период
Сортировка
От Michelle Konzack
Тема [GENERAL] SELECT statement with sub-queries
Дата
Msg-id 20170528170355.GH3646@cq58.hosts.tdnet.eu
обсуждение исходный текст
Ответы Re: [GENERAL] SELECT statement with sub-queries  (Amitabh Kant <amitabhkant@gmail.com>)
Re: [GENERAL] SELECT statement with sub-queries  (rob stone <floriparob@gmail.com>)
Re: [GENERAL] SELECT statement with sub-queries  (ml@ft-c.de)
Список pgsql-general
Hello *,

I try to get columns from my database with a singel SELECT, but I stuck.

I have 3 tables like:


1)  categories (serial,cat)

2)  manufacturers (serial,m_name)

3)  products (serial,category,manufacturer,p_name)


where the "category" and "manufacturer"
are numerical IDs from the two tables above.

So I like to replace the numerical IDs with the appropriated values,
mean

SELECT * FROM products WHERE category IN
    (SELECT categories.cat FROM categories WHERE
    categories.serial==products.category);

But I get:

ERROR:  operator does not exist: integer==integer
LINE1: ...gories.cat FROM categories WHERE  categories.serial==products.category);
                                                             ^
Hmm, "serial" is an "integer" and the "category" and "manufacturer" too.

So whats wrong with it?







--
Michelle Konzack        Miila ITSystems @ TDnet
GNU/Linux Developer     00372-54541400

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Arup Rakshit
Дата:
Сообщение: Re: [GENERAL] Question regarding the output of postgresql *explain*command
Следующее
От: Amitabh Kant
Дата:
Сообщение: Re: [GENERAL] SELECT statement with sub-queries