Invoice Importer
Mike Evans
mikee at saxicola.idps.co.uk
Mon Apr 2 09:38:50 EDT 2012
On Mon, 02 Apr 2012 09:10:06 -0400
Derek Atkins <warlord at mit.edu> wrote:
> Reuben Cummings <reubano at gmail.com> writes:
>
> >>>>> SELECT
> >>>>> entries.invoice
> >>>>>
> >>>>> FROM entries
> >>>>> LEFT OUTER JOIN invoices ON entries.invoice =
> >>>>> invoices.guid WHERE invoices.guid IS NULL
> >>>>> GROUP BY entries.invoice
> >>>>
> >>>> Do you really need the join here?
> >>>
> >>> Yes. Since the orphan entries are identical to the non-orphan
> >>> entries, the only way to filter them out is to join on the
> >>> invoices table and exclude all the entries that match. That
> >>> leaves entries with non-matching invoices... the orphan entries.
> >>
> >> Really? Why can't you just do:
> >>
> >> SELECT ... FROM entries where entries.invoice IS NULL?
> >
> > Because entries.invoices isn't null. Even the orphan entries have
> > an invoice guid. It just that these guids are not present in the
> > invoices table.
>
> Oh, so the issue is that there was an Invoice that was created in RAM
> but never committed. I see. That could never happen through the GUI,
> but the importer clearly bypasses the GUI. So the Entries have a
> reference to a non-existing Invoice. Very Interesting.
>
> Thanks for working through this with me.
>
> -derek
>
This, I think, was caused when the importer skipped alternate rows in
the invoice entries. I has since, I hope, been fixed.
Mike E
--
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.
More information about the gnucash-devel
mailing list