Hi All,
> I have three tables (simplified here): Invoices, Orders and Moves.
> Each Invoice to a customer is for one or more products moved to them
> (ie sold to them). Each one of those products is moved (ie bought)
> from a supplier, incurring one or more Orders to satisfy each Invoice.
>
Hi Igor,
>> the Order - Invoice relationship is many-to-many.
> How are you going to break down order delivery charges in this case?
Good question. I have been wondering the same. It's a purely auditing/
accounting requirement, to compare the expense and income of a
particular invoice. For th
BareFeet <[EMAIL PROTECTED]> wrote:
> Unfortunately I can't do away with the intermediate "Moves" table,
> since the Order - Invoice relationship is many-to-many. That is,
> although each Order usually belongs to just one Invoice, sometimes one
> Order for may include products that are invoiced sep
Hi Igor,
>> So is there no better way to achieve this result?
>
> I couldn't think of one.
Hmm, OK. That's bad news for elegance, but I guess good news that I'm
not going crazy and not seeing the obvious.
> It might help to denormalize a little by adding InvoiceId to Orders
> table.
Unfortu
BareFeet <[EMAIL PROTECTED]> wrote:
> So is there no better way to achieve this result?
I couldn't think of one.
It might help to denormalize a little by adding InvoiceId to Orders
table.
Igor Tandetnik
___
sqlite-users mailing list
sqlite-users@s
Hi Igor,
Thanks for replying.
> BareFeet <[EMAIL PROTECTED]> wrote:
>> I tried this:
>>
>> select
>> "Invoices".ID as Invoice
>>, (select sum(Buy) from Moves where Moves.Invoice = Invoices.ID)
>> as "Sum Buy"
>>, (select sum(Delivery) from "Orders" on "Orders".ID in (select
>> "O
BareFeet <[EMAIL PROTECTED]> wrote:
> I tried this:
>
> select
> "Invoices".ID as Invoice
> , (select sum(Buy) from Moves where Moves.Invoice = Invoices.ID) as
> "Sum Buy"
> , (select sum(Delivery) from "Orders" on "Orders".ID in (select
> "Order" from Moves where Invoice = Invoices.ID)) as "Sum
7 matches
Mail list logo