PlayerUnknown
New member
- Local time
- Today, 11:59
- Joined
- Mar 14, 2018
- Messages
- 1
Hello,
I have a table with the following fields:
Invoice
Division
Amount
The Invoice can repeat (and often does) as each invoice can have multiple divisions. Divisions can also repeat for a single invoice as separate records have different Amounts.
What I need is a query that will tell me which Division for each Invoice has the highest Amount:
ID Invoice Division Amount
1 12345 ABC 500.00
2 12345 ABC 250.00
3 12345 DEF 650.00
4 12345 GHI 700.00
5 67890 ABC 250.00
6 67890 DEF 450.00
7 67890 GHI 150.00
The desired query result would be this:
ID Invoice Division Amount
??? 12345 ABC 750.00
??? 67890 DEF 450.00
The actual source data has many more fields (that I do not need in the query results), and consists of 150K+ records so query performance is also a concern, although I will take what I can get at this point.
I have reached the limit of my experience with trying to resolve this and would much appreciate some assistance from someone with more skill at this than myself.
:banghead:
Thanks in advance.
I have a table with the following fields:
Invoice
Division
Amount
The Invoice can repeat (and often does) as each invoice can have multiple divisions. Divisions can also repeat for a single invoice as separate records have different Amounts.
What I need is a query that will tell me which Division for each Invoice has the highest Amount:
ID Invoice Division Amount
1 12345 ABC 500.00
2 12345 ABC 250.00
3 12345 DEF 650.00
4 12345 GHI 700.00
5 67890 ABC 250.00
6 67890 DEF 450.00
7 67890 GHI 150.00
The desired query result would be this:
ID Invoice Division Amount
??? 12345 ABC 750.00
??? 67890 DEF 450.00
The actual source data has many more fields (that I do not need in the query results), and consists of 150K+ records so query performance is also a concern, although I will take what I can get at this point.
I have reached the limit of my experience with trying to resolve this and would much appreciate some assistance from someone with more skill at this than myself.
:banghead:
Thanks in advance.