Re: Probably a newbie question

From: Melvin Davidson <melvin6925(at)gmail(dot)com>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: Ron <ronljohnsonjr(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Probably a newbie question
Date: 2019-08-10 20:13:15
Message-ID: CANu8FiwUHELdLdF0vtnQsuMJDRxBABXVV+89oK2fLM9jUEG2uA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>ERROR: more than one row returned by a subquery used as an expression

Without knowledge as to the contents of your data, the best I can suggest is
to use *SELECT DISTINCT* in your subqueries.

On Sat, Aug 10, 2019 at 3:42 PM Rob Sargent <robjsargent(at)gmail(dot)com> wrote:

>
>
> I'd look here:
>
> SELECT
> name
> FROM
> vendor
> WHERE
> bom_item.vendor_key =
> (
> SELECT
> vendor_key
> FROM
> mfg_vendor_relationship
> WHERE
> bom_item.mfg_key = mfg_key
> AND
> prefered = TRUE
> AND
> bom_item.project_key = project_key
>
> )
>
>
> --
> Angular momentum makes the world go ‘round.
>
>
> You might get away with adding
> group by vendor_key
> if it turns out you’re simply getting many copies of vendor key from that
> inner select.
> Run it alone to see.
>
>
>

--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2019-08-10 20:46:20 Re: Probably a newbie question
Previous Message Melvin Davidson 2019-08-10 20:11:07 Re: FW: Undelivered Mail Returned to Sender