Complex selection queries on multiple tables
Posted: Thu Oct 24, 2013 11:00 am
This is a difficult question to post but I will do my best to make sense.
I have a manufacturing company and we make produce to order only. So I have created an application with a customer table with customerID and customerName.
I create a sales record in the sales table which links to:
1. customer table by customerID
2. products table by productID
I also have a salesDate and a salesQty and salesID. The sales table links to the production and collections tables using a salesID, productID and customerID so that I can track sales, production and collections BY customer BY product for each month.
I need to create a monthly stock accounting report that will show all sales, production and collections to date and all sales, production and collections for the current period. From this, I can work out what stock I should have on hand and what outstanding collections there are per customer by product.
I really need help putting together selection queries and manipulating the resulting array to show all this information. I would post what I have tried but I end up having too many lookups and my code becomes messy and difficult to understand. I have attached my sqlite database with data.I have also attached a spreadsheet of how my current stock accounting report looks.
Any help here would save me a lot of time and frustration.
I have a manufacturing company and we make produce to order only. So I have created an application with a customer table with customerID and customerName.
I create a sales record in the sales table which links to:
1. customer table by customerID
2. products table by productID
I also have a salesDate and a salesQty and salesID. The sales table links to the production and collections tables using a salesID, productID and customerID so that I can track sales, production and collections BY customer BY product for each month.
I need to create a monthly stock accounting report that will show all sales, production and collections to date and all sales, production and collections for the current period. From this, I can work out what stock I should have on hand and what outstanding collections there are per customer by product.
I really need help putting together selection queries and manipulating the resulting array to show all this information. I would post what I have tried but I end up having too many lookups and my code becomes messy and difficult to understand. I have attached my sqlite database with data.I have also attached a spreadsheet of how my current stock accounting report looks.
Any help here would save me a lot of time and frustration.