473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

aggregate / subquery help

13
This seems like it should be straight forward but I can't figure it out. I want to find the largest quantity for each Item and have it return the ID for each group.

ID Item Quantity
1 A 4
2 A 3
3 A 5
4 B 3
5 B 5
6 B 4
7 C 5
8 C 4
9 C 3

Anticipated Results:
ID Item Quantity
3 A 5
5 B 5
7 C 5
May 9 '16 #1

✓ answered by Rabbit

Do a query to find the largest quantity by group. Then join the result of that back to the table to find the ID.

1 777
Rabbit
12,516 Expert Mod 8TB
Do a query to find the largest quantity by group. Then join the result of that back to the table to find the ID.
May 9 '16 #2

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

Similar topics

2
by: Steve Edwards | last post by:
Here's my setup. I have three tables I am working with: product, attribute, and vendor. An attribute is a variation of a product. For instance, if I have a widget, a red widget would be one...
0
by: leegold2 | last post by:
I tried what's below, seemed OK, so I replaced an "IN" for the "=" in the subquery below because of the subquery's error message. I thought w/"IN" I'd get three (3) records returned as expected....
3
by: Not4u | last post by:
I would like to know which products are my best sells by sellers, but i would like to retreive this info by product id, seller id and the total amount of sells for this product. My Sells table...
8
by: Neeper | last post by:
I'm trying to pull the last 10 records from a transactions from a table using this query: SELECT * FROM transactions ORDER BY timestamp DESC LIMIT 10 But I want to display the rows in...
2
by: Hexman | last post by:
Don't know if this is the proper newsgroup to post to. Sorry if not. Can't figure this one out. Using Access 2003. I have 2 tables, IMast (table of part info) and THist (part transaction...
2
by: BerkshireGuy | last post by:
tblDetails has the following fields: AgencyCode, ProducerCode, AnnualPX How can I create a query to show the Top 5 producers with the highest PX per agency? Can a subquery do it? TIA
2
by: dcourington | last post by:
I'm new to this group and not an experienced Access user, but have solved several of my problems already by reading other threads on this forum (Thanks!). Here's my current problem that I can't...
4
by: BeeMarie | last post by:
Hi, I've been trying to figure out this query for several days. I'm not that familiar with writing SQL statements, but in order to get the results I want, I think I need a subquery which requires...
2
by: ktrw25 | last post by:
Is there a better way to write the statement below with postgre. It works fine, wondering if there might be a way with with only 1 extract. I just need only results returned if they fall on a 10...
1
by: Ken Biggs | last post by:
How do I do this in one select query Query one - or Base Table from fields above SELECT qryASMCur.REGION, qryASMCur.Area, qryASMCur., qryASMCur.NAME, qryASMCur.AccountManager,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.