Re: SELECT statement with sub-queries

From: Michelle Konzack <linux4michelle(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SELECT statement with sub-queries
Date: 2017-05-28 18:54:03
Message-ID: 20170528185403.GJ3646@cq58.hosts.tdnet.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2017-05-28 11:23:47 Adrian Klaver hacked into the keyboard:
> On 05/28/2017 10:53 AM, Michelle Konzack wrote:
> >>
> >>SELECT * FROM products WHERE category IN
> >> (SELECT categories.cat FROM categories WHERE
> >> categories.serial = products.category);

> Because you are comparing categories.cat

ehm no

I want to replace in the output the numerical ID from "products.category"
with the value of "categories.cat", where the "products.category" match
the "categories.serial"

> which is a varchar to
> products.category which is an integer. The above is crying out for
> FOREIGN KEYS. For the time being I going to assume products.category
> is a faux FK to categories.serial so;
>
> SELECT * FROM products WHERE products.category = categories.serial;

This is not working

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michelle Konzack 2017-05-28 18:55:37 Re: SELECT statement with sub-queries
Previous Message ml 2017-05-28 18:24:43 Re: SELECT statement with sub-queries