Re: [GENERAL] SELECT statement with sub-queries
От
rob stone
Тема
Re: [GENERAL] SELECT statement with sub-queries
Дата
Msg-id
1495992294.8904.1.camel@gmail.com
Ответ на
[GENERAL] SELECT statement with sub-queries (Michelle Konzack)
Список
Дерево обсуждения
[GENERAL] SELECT statement with sub-queries Michelle Konzack <linux4michelle@gmail.com>
Re: [GENERAL] SELECT statement with sub-queries rob stone <floriparob@gmail.com>
Re: [GENERAL] SELECT statement with sub-queries Michelle Konzack <linux4michelle@gmail.com>
Re: [GENERAL] SELECT statement with sub-queries Adrian Klaver <adrian.klaver@aklaver.com>
Re: [GENERAL] SELECT statement with sub-queries Michelle Konzack <linux4michelle@gmail.com>
Re: [GENERAL] SELECT statement with sub-queries "David G. Johnston" <david.g.johnston@gmail.com>
Re: [GENERAL] SELECT statement with sub-queries Adrian Klaver <adrian.klaver@aklaver.com>
Re: [GENERAL] SELECT statement with sub-queries Michelle Konzack <linux4michelle@gmail.com>
Re: [GENERAL] SELECT statement with sub-queries Amitabh Kant <amitabhkant@gmail.com>
Hello, On Sun, 2017-05-28 at 20:03 +0300, Michelle Konzack wrote: > 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? > > You only need a single equals sign in SQL. SELECT * FROM products WHERE category IN (SELECT categories.cat FROM categories WHERE categories.serial = products.category); Cheers, Rob
В списке pgsql-general по дате отправления
От: Thomas Kellerer
Дата: