I have a database containing an ItemTypesColors table which has a 1:Many relationship with an ItemDescription table which has a 1:Many relationship with an ItemVendor table.
Multiple Vendors can supply White Shirts but will do so in varying Quantities, at different Prices and differ in whether they offer a discount, charge sales tax or shipping etc.
I have a form allowing user to enter the Item Type, Color & Quantity they want. I then have a query that calculates the total price of each Vendor’s offering. This is working nicely but another query that utilizes this in order to return the minimum price for each Item Type & Color combination is returning duplicate records for those Item & Color combinations supplied by multiple Vendors.
If I return just ItemTypesColors ID & MinOfPrice then I get exactly what I want, 1 price for each ItemTypesColors ID:
The problem with this is that ItemTypesColors ID doesn’t get me to the ItemVendor that’s cheapest. For that I need to add the ItemDescription ID but when I do that I get duplicated records, eg:
At one point in time I made a change that resulted in $27.99 being returned for 144|41, 144|42 & 144|43 but I’m not sure how I did that.
Could anybody advise what I need to change in my query such that it retrieves all 3 fields as above but just one record for each instance of ItemTypesColors ID?
This is the code currently in my query:
Thank you for any assistance.
Maybe an image will help. The following is currently being returned by a query. I don't necessarily want to modify this query because I might want access to all this information at same other time. How do I write a query to just return the lowest iTotalPrice along with ItemDescription ID for each tblItemTypesIte mColorJunction_ ID, ie: eliminate the two records with red lines through them?
[IMGnothumb]http://i819.photobucke t.com/albums/zz117/jase7678/Access%20Query% 20Discussion%20 Forum/Capture.png[/IMGnothumb]
Thank you.
- The ItemTypesColors table comprises Item Type & Color, eg: Shirts|White, Shirts|Black, Jeans|Blue etc.
- The ItemDescription table contains the number of items in a package, a link to the ItemVendor table, price etc.
- The ItemVendor table contains the Vendor name, a discount %, Sales Tax % & Shipping Fee.
Multiple Vendors can supply White Shirts but will do so in varying Quantities, at different Prices and differ in whether they offer a discount, charge sales tax or shipping etc.
I have a form allowing user to enter the Item Type, Color & Quantity they want. I then have a query that calculates the total price of each Vendor’s offering. This is working nicely but another query that utilizes this in order to return the minimum price for each Item Type & Color combination is returning duplicate records for those Item & Color combinations supplied by multiple Vendors.
If I return just ItemTypesColors ID & MinOfPrice then I get exactly what I want, 1 price for each ItemTypesColors ID:
Code:
[ItemTypesColorsID][MinOfPrice] 132 $63.18 136 $40.00 138 $288.98 139 $110.49 144 $27.99
Code:
[ItemTypesColorsID][MinOfPrice][ItemDescriptionID] 132 $63.18 73 136 $40.00 272 138 $288.98 286 139 $110.49 18 144 $37.98 41 144 $27.99 42 144 $46.98 43
Could anybody advise what I need to change in my query such that it retrieves all 3 fields as above but just one record for each instance of ItemTypesColors ID?
This is the code currently in my query:
Code:
SELECT qry_1_TotalPricesOfItemsByEventRevisionID.tblItemTypesColorsJunction_ID , Min(qry_1_TotalPricesOfItemsByEventRevisionID.Price) AS MinOfPrice , qry_1_TotalPricesOfItemsByEventRevisionID.ItemDescriptionID FROM qry_1_TotalPricesOfItemsByEventRevisionID GROUP BY qry_1_TotalPricesOfItemsByEventRevisionID.tblItemTypeItemColorJunction_ID , qry_1_TotalPricesOfItemsByEventRevisionID.ItemDescriptionID;
Maybe an image will help. The following is currently being returned by a query. I don't necessarily want to modify this query because I might want access to all this information at same other time. How do I write a query to just return the lowest iTotalPrice along with ItemDescription ID for each tblItemTypesIte mColorJunction_ ID, ie: eliminate the two records with red lines through them?
[IMGnothumb]http://i819.photobucke t.com/albums/zz117/jase7678/Access%20Query% 20Discussion%20 Forum/Capture.png[/IMGnothumb]
Thank you.
Comment