Results 1 to 2 of 2
  1. #1
    wz72n01 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2009
    Posts
    1

    Question Help writing multiple queries

    If I have the following 3 records with the same unique identifier Seller Part Number1: B1234...

    Seller Part Number1: B1234
    Location1: Kansas
    Part Number1: A1234
    Customer Price1: $10
    Seller Price1: $8


    Volume1: 20

    Seller Part Number1: B1234
    Location2: Georgia
    Part Number2: A2345
    Customer Price2: $12
    Seller Price1: $8
    Volume2: 15

    Seller Part Number1: B1234
    Location3: Colorado
    Part Number1: A3456
    Customer Price3: $14
    Seller Price2: $6
    Volume3: 10

    Comparing the same Seller Part Number1, how do I correctly calculate

    #1 The difference between a location's Customer Price and the lowest Customer Price and multiply by the location's volume

    e.g. Location2 would be Location2 Customer Price $12 - Location1 Customer Price since it is the lowest $10 x Location2 Volume 15
    $12-$10 x 15 = $30 lost money due to pricing irregularities

    #2 The difference between the lowest Seller price and each location(e.g. Location1 would be $10 - $6 x 20)
    $6 is the lowest Seller Price2

    Since the Seller Part Number1 is the same, all the information should be the same, BUT IT IS NOT. I want to understand the difference. Can anyone here help? I was told to use a WHERE function, but not sure how to implement it.

  2. #2
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    Try the following Query:-
    Code:
    SELECT SellerPartNo1, Location, PartNo, CustPrice, SellerPrice, Volume, 
    (CustPrice-(SELECT Min(CustPrice) FROM Dbase))*volume AS DiffCPriceVol, 
    (SellerPrice-(SELECT Min(SellerPrice) FROM Dbase))*volume AS DiffSPriceVol
    FROM Dbase;

Please reply to this thread with any new information or opinions.

Similar Threads

  1. I need help writing a query statement
    By dking in forum Queries
    Replies: 1
    Last Post: 02-25-2009, 09:43 AM
  2. Replies: 1
    Last Post: 06-21-2007, 01:02 PM
  3. Replies: 0
    Last Post: 06-07-2007, 02:33 PM
  4. Replies: 0
    Last Post: 03-19-2006, 11:52 PM
  5. Force writing from the right in a field?
    By Looping in forum Forms
    Replies: 0
    Last Post: 01-23-2006, 03:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums