timv
February 15th, 2005, 04:20 AM
Hi,
i have two queries, one for getting sales and one for getting orders. The data is in two different tables, the 'sales' table and the 'order' table.
They look like
SELECT customer, supplier, sum(quantity), article, price FROM sales GROUP BY customer, article, supplier
SELECT customer, supplier, sum(quantity), article, price FROM orders GROUP BY customer, article, supplier
Now, in a pivottable (in excel) i want the quantities sold compared with the quantities ordered. Combined for each customer, supplier, article,....
The data i want to have in my pivottable is e.g. the quantity sold and the quantity ordered of article x by customer y supplied by a supplier z.
I can't figure out how to put this data in one query. Or perhaps it's possible to have one pivottable based on multiple queries in excel?
I thought i could use the union command with an extra column type ('sale'/'order') but because of the trouble with the column names of the databases, their different meanings for sales/orders and because i need extra data (other columns that are in sales but not in orders and so on) i am looking for an other solution.
Can someone advice me on this?
grts,
timv
i have two queries, one for getting sales and one for getting orders. The data is in two different tables, the 'sales' table and the 'order' table.
They look like
SELECT customer, supplier, sum(quantity), article, price FROM sales GROUP BY customer, article, supplier
SELECT customer, supplier, sum(quantity), article, price FROM orders GROUP BY customer, article, supplier
Now, in a pivottable (in excel) i want the quantities sold compared with the quantities ordered. Combined for each customer, supplier, article,....
The data i want to have in my pivottable is e.g. the quantity sold and the quantity ordered of article x by customer y supplied by a supplier z.
I can't figure out how to put this data in one query. Or perhaps it's possible to have one pivottable based on multiple queries in excel?
I thought i could use the union command with an extra column type ('sale'/'order') but because of the trouble with the column names of the databases, their different meanings for sales/orders and because i need extra data (other columns that are in sales but not in orders and so on) i am looking for an other solution.
Can someone advice me on this?
grts,
timv