G
Guillermo_Lopez
Hello All,
What I am trying to do here is select the smallest value from a group
of data. If i have something like this:
Item_ID SizeType LocCapacity
P1234 Type1 334
P1234 Type2 100
P5678 Type1 54
P5678 Type2 80
And the result i want is for each ItemID what is the Type with the
smallest capacity.
I have done it before about a year ago, and it worked great, except
that now i forgot how i did it, and i can't recover my resource. The
way i have it now which should work, takes too long to run my table of
13,000 records. And I remember there was another way to do this, but i
forgot how.
SELECT Q1.Item_ID, Q1.SizeType, Q1.LocCapacity
FROM Q209_2_All_Locations AS Q1
WHERE Q1.SizeType In (SELECT Top 1 Q2.SizeType, Q2.Item_ID FROM
Q209_2_All_Locations AS Q2 WHERE [Q2].[Item_ID]=[Q1].[Item_ID] ORDER
BY [Q2].[LocCapacity];
Thanks in Advanced
- GL
What I am trying to do here is select the smallest value from a group
of data. If i have something like this:
Item_ID SizeType LocCapacity
P1234 Type1 334
P1234 Type2 100
P5678 Type1 54
P5678 Type2 80
And the result i want is for each ItemID what is the Type with the
smallest capacity.
I have done it before about a year ago, and it worked great, except
that now i forgot how i did it, and i can't recover my resource. The
way i have it now which should work, takes too long to run my table of
13,000 records. And I remember there was another way to do this, but i
forgot how.
SELECT Q1.Item_ID, Q1.SizeType, Q1.LocCapacity
FROM Q209_2_All_Locations AS Q1
WHERE Q1.SizeType In (SELECT Top 1 Q2.SizeType, Q2.Item_ID FROM
Q209_2_All_Locations AS Q2 WHERE [Q2].[Item_ID]=[Q1].[Item_ID] ORDER
BY [Q2].[LocCapacity];
Thanks in Advanced
- GL