From: | ml(at)ft-c(dot)de |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: SELECT statement with sub-queries |
Date: | 2017-05-28 18:24:43 |
Message-ID: | a9949bd7-fc99-fe1b-77e1-958ce5c252e8@ft-c.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 28.05.2017 20:19, ml(at)ft-c(dot)de wrote:
> Hallo,
>
> SELECT *
> FROM products
> WHERE exists
> (SELECT categories.cat FROM categories WHERE
> categories.serial==products.category);
categories.serial = products.category); -- one equal sign
> or
> SELECT * FROM products
> WHERE category IN
> (SELECT categories.cat FROM categories);
>
> On 28.05.2017 19:03, 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?
>>
>>
>>
>>
>>
>>
>>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michelle Konzack | 2017-05-28 18:54:03 | Re: SELECT statement with sub-queries |
Previous Message | Adrian Klaver | 2017-05-28 18:23:47 | Re: SELECT statement with sub-queries |