pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: Nicolas Seinlet <nicolas@seinlet.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: More records after sort
Date: Tue, 20 Jul 2021 18:55:27 -0600
Message-ID: <44CF8418-C67F-405C-BD36-763F4F2412E4@gmail.com> (raw)
In-Reply-To: <XIvi0CUmhXFqNzBx3QlNJcwzA9_twozgYMgvvU77b_9eFO0e6_X0LbONKuLPFsGSWGWDRG931KAVa3_RGo41LtFD9WZWlLqpX53N-5mS4oQ=@seinlet.com>
References: <sccAkd2JVf0NntlWtYcU8-h-xCZxuwuCqF1vpTrIG1VR1DffM3t4QlMiMRrLR4VyJm5oyUa1n-TmPhnkCA6fLoT0tfAWGD2c7NlrihonP9Q=@seinlet.com>
	<368621.1626791677@sss.pgh.pa.us>
	<XIvi0CUmhXFqNzBx3QlNJcwzA9_twozgYMgvvU77b_9eFO0e6_X0LbONKuLPFsGSWGWDRG931KAVa3_RGo41LtFD9WZWlLqpX53N-5mS4oQ=@seinlet.com>

> Query:
> INSERT INTO invl_aml_mapping_temp(invl_id, aml_id, cond)
>                SELECT il.id, ml.id, 48
>                    FROM account_invoice_line il
>                    JOIN account_invoice i ON i.id = il.invoice_id
>                    JOIN account_move m ON m.id = i.move_id
>                    JOIN account_move_line ml ON ml.move_id = m.id
>                    JOIN res_company comp ON comp.id = i.company_id
>                WHERE il.display_type IS NULL
>                  AND ml.tax_line_id IS NULL
>                  AND NOT EXISTS (SELECT invl_id FROM invl_aml_mapping WHERE invl_id=il.id)
>                  AND NOT EXISTS (SELECT aml_id FROM invl_aml_mapping WHERE aml_id=ml.id)
>                  AND i.id = 

Out of curiosity, would combining those two NOT EXISTS in one help? Ever? 
i.e. WHERE invl_id=il.id or aml_id = ml.id

view thread (6+ messages)  latest in thread

Message-ID: <44CF8418-C67F-405C-BD36-763F4F2412E4@gmail.com>
Permalink:  ../44CF8418-C67F-405C-BD36-763F4F2412E4@gmail.com/
Also on:    postgresql.org/message-id/44CF8418-C67F-405C-BD36-763F4F2412E4@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robjsargent@gmail.com, nicolas@seinlet.com
  Subject: Re: More records after sort
  In-Reply-To: <44CF8418-C67F-405C-BD36-763F4F2412E4@gmail.com>
  References: <sccAkd2JVf0NntlWtYcU8-h-xCZxuwuCqF1vpTrIG1VR1DffM3t4QlMiMRrLR4VyJm5oyUa1n-TmPhnkCA6fLoT0tfAWGD2c7NlrihonP9Q=@seinlet.com> <368621.1626791677@sss.pgh.pa.us> <XIvi0CUmhXFqNzBx3QlNJcwzA9_twozgYMgvvU77b_9eFO0e6_X0LbONKuLPFsGSWGWDRG931KAVa3_RGo41LtFD9WZWlLqpX53N-5mS4oQ=@seinlet.com> <44CF8418-C67F-405C-BD36-763F4F2412E4@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox