[prev in list] [next in list] [prev in thread] [next in thread]
List: postgresql-general
Subject: Re: More records after sort
From: Nicolas Seinlet <nicolas () seinlet ! com>
Date: 2021-07-21 17:25:43
Message-ID: Fw_xFkgR_77EDVaNGxJKwlZ_hbShKe3UGjnZgWoHJtXM2pSJgIenzVv67V90oCYoiyEFHfqm4TXuGg-oVDSQ-A8Z7_LpAd-b6bdiEqr_WF8= () seinlet ! com
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
[Attachment #4 (multipart/alternative)]
Thanks all, I'll try this on Monday when I go back to the office.
Nicolas.
------- Original Message -------
On Wednesday, July 21st, 2021 at 02:55, Rob Sargent <robjsargent@gmail.com> wrote:
> > 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
[Attachment #7 (multipart/related)]
[Attachment #9 (text/html)]
<div></div><div class="protonmail_signature_block \
protonmail_signature_block-empty"><div class="protonmail_signature_block-proton \
protonmail_signature_block-empty"></div></div><div>Thanks all, I'll try this on \
Monday when I go back to the \
office.<br></div><div><br></div><div>Nicolas.<br></div><div \
class="protonmail_quote"><div>------- Original Message -------<br></div><div>On \
Wednesday, July 21st, 2021 at 02:55, Rob Sargent <robjsargent@gmail.com> \
wrote:<br></div></div><div><br></div><blockquote class="protonmail_quote" \
type="cite"> <div><blockquote class="" type="cite"><div class=""><div \
class="">Query:<br class="">INSERT INTO invl_aml_mapping_temp(invl_id, aml_id, \
cond)<br class=""> SELECT \
<a class="" href="http://il.id" target="_blank" rel="noreferrer nofollow \
noopener">il.id</a>, <a class="" href="http://ml.id" target="_blank" rel="noreferrer \
nofollow noopener">ml.id</a>, 48<br class=""> \
FROM \
account_invoice_line il<br class=""> \
JOIN \
account_invoice i ON <a class="" href="http://i.id" target="_blank" rel="noreferrer \
nofollow noopener">i.id</a> = il.invoice_id<br class=""> \
JOIN \
account_move m ON <a class="" href="http://m.id" target="_blank" rel="noreferrer \
nofollow noopener">m.id</a> = i.move_id<br class=""> \
JOIN \
account_move_line ml ON ml.move_id = <a class="" href="http://m.id" target="_blank" \
rel="noreferrer nofollow noopener">m.id</a><br class=""> \
JOIN \
res_company comp ON <a class="" href="http://comp.id" target="_blank" rel="noreferrer \
nofollow noopener">comp.id</a> = i.company_id<br class=""> \
WHERE \
il.display_type IS NULL<br class=""> \
AND \
ml.tax_line_id IS NULL<br class=""> \
AND \
NOT EXISTS (SELECT invl_id FROM invl_aml_mapping WHERE invl_id=<a class="" \
href="http://il.id" target="_blank" rel="noreferrer nofollow noopener">il.id</a>)<br \
class=""> AND \
NOT EXISTS (SELECT aml_id FROM invl_aml_mapping WHERE aml_id=<a class="" \
href="http://ml.id" target="_blank" rel="noreferrer nofollow noopener">ml.id</a>)<br \
class=""> AND \
<a class="" href="http://i.id" target="_blank" rel="noreferrer nofollow \
noopener">i.id</a> = </div></div></blockquote><br class=""></div><div>Out of \
curiosity, would combining those two NOT EXISTS in one help? \
Ever? </div><blockquote class="" style="margin: 0 0 0 40px; border: none; \
padding: 0px;"><div>i.e. WHERE invl_id=<a class="" href="http://il.id" \
target="_blank" rel="noreferrer nofollow noopener">il.id</a> or aml_id = <a class="" \
href="http://ml.id" target="_blank" rel="noreferrer nofollow \
noopener">ml.id</a></div></blockquote><br class=""><div class=""><br class=""></div> \
</blockquote>
-----------------------840e3cf347d21fa88e32ac880db362a6--
["publickey - nicolas@seinlet.com - 0xCAEB7FAF.asc" (application/pgp-keys)]
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic