I just happened to run a query for a specific transaction:
SELECT tl.transaction_line_id, tl.amount, tl.transaction_order FROM TRANSACTIONS AS t INNER JOIN TRANSACTION_LINES AS tl ON tl.Transaction_id = t.transaction_id WHERE t.Transaction_ID = 8528
Here are the results (I hope they are formatted decent) transaction_line_id amount transaction_order 0 225 0 1 -225 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 0 19
My main question is why does a transaction with a SINGLE line item have 20 line item records? I can speculate what some of them are:
0) the item sold
1) a credit that might have been applied
19) shipping (that was zeroed out)
What about 2-18? What are they, why are they there?
Another question: Am I correct to assume that the PK for transaction_lines is a composite of transaction_id + transaction_line_id? If not, where is the PK for this view/table?
Thanks for any help,
Steve