By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,478 Members | 1,513 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,478 IT Pros & Developers. It's quick & easy.

Is this an array?

P: 13
I have an access 2007 database ... a report I am running, uses a query that uses a one to many relationship. The one table has the person's name, etc. and the many table, has values such as how many times they had dinner out for example ...

... now, in the report, I want to take the second 'occurrence' of the above field ("# of dinners out") and subtract it from the first 'occurrence' of the SAME field???

I do need to actually show the first occurrence and second occurrence values in the report and then the third field would show the difference between them ... well of course there is a SUM function but no SUBTRACT function ... you cannot use the minus because its the same field ... just 2 occurrences (or 2 records of the same person)

It would look something like this:

Name # dinners out
1st 2nd diff
Joe 10 12 2

Help!!

Thanks, Tina
Nov 6 '11 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,679
If I understand correctly, you wojld have to create a new Data Source for the Report based on your Query. Kindly Post the SQL for your Query.
Nov 6 '11 #2

P: 13
I don't know SQL or VBA very well ... so this may just confuse me ... is there no way to simply refer to the second occurrence of a field - first occurrence of a field ...

like:

[dinners out](2)-[dinners out](1)?

the sql is monsterous for this ...
Nov 6 '11 #3

NeoPa
Expert Mod 15k+
P: 31,709
Tina Robinson:
is there no way to simply refer to the second occurrence of a field - first occurrence of a field
No Tina. One of the fundamental principles is that the data is not held in any specific order. ==> such a concept is anathema to basic database theory.

It can often be managed by clever manipulation, but it's not simple or standard. Rather it's senseless.
Nov 11 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.