N
Niklas Östrergren
Does your tables have any unique field that linkt hte records to each other?
If so that would be a little bit easyer to group the data the way you like.
What I can see from your msg is that both tables are ascended sorted so you
could first sort the tables the way you want and then add a new field
(AutoNumber, lets call it [ExpenseID] and [SaleID]) to each table. This will
give the first record in each table ID no 1, next record 2 and so on.
Whist this in mind you create a relationship between the tables in the query
selecting all records from the tables with most records in. And finaly
creating a query like this:
SELECT tblExpense.ExpenseAmount, tblSale.SaleAmount
FROM tblExpense LEFT JOIN tblSale ON tblExpense.ExpenseID = tblSale.SaleID;
In this example I have named the tables tblExpense and tblSale and I also
have selected all records from tbalExpense since that´s the table (in my
example) that have most records.
What I´m thinking of is if you realy want to present the result like this?
Don´t you need to group it by date or something else like employee or what
ever? I don´t know your aplication so I´m a little out in the dark here but
just selecting amouts sorted byt the way they where entered in the tables
are rare and, if you ask me, not very useful. Just a thought!
// Niklas
If so that would be a little bit easyer to group the data the way you like.
What I can see from your msg is that both tables are ascended sorted so you
could first sort the tables the way you want and then add a new field
(AutoNumber, lets call it [ExpenseID] and [SaleID]) to each table. This will
give the first record in each table ID no 1, next record 2 and so on.
Whist this in mind you create a relationship between the tables in the query
selecting all records from the tables with most records in. And finaly
creating a query like this:
SELECT tblExpense.ExpenseAmount, tblSale.SaleAmount
FROM tblExpense LEFT JOIN tblSale ON tblExpense.ExpenseID = tblSale.SaleID;
In this example I have named the tables tblExpense and tblSale and I also
have selected all records from tbalExpense since that´s the table (in my
example) that have most records.
What I´m thinking of is if you realy want to present the result like this?
Don´t you need to group it by date or something else like employee or what
ever? I don´t know your aplication so I´m a little out in the dark here but
just selecting amouts sorted byt the way they where entered in the tables
are rare and, if you ask me, not very useful. Just a thought!
// Niklas