Re: Query with conditional statement

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Query with conditional statement
Date: 2023-09-13 18:07:05
Message-ID: CAKFQuwa5n3OOz2-i7T=9oLfHNUxipeEAzFBXz2OETnOL3BX6xQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Sep 13, 2023 at 10:53 AM JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
wrote:

> I need to return more than 1 field on each WHEN and also assign an ALIAS.
>
>
You can only produce a single value of a specific data type from the output
of a case expression. To do what you desire, create a custom composite
type and return that. You get to name the fields when you define the
composite type.

David J.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Shane Borden 2023-09-13 20:39:49 Re: Query with conditional statement
Previous Message Tchouante, Merlin 2023-09-13 17:57:54 RE: Query with conditional statement