Best supplier price query

Common questions about 1C:Query language, Query builder tool and Data composition schema

#1
People who like this:0Yes/0No
Active user
Rating: 5
Joined: Sep 27, 2011
Company:

Hello!
I have a complicated question about queries this time.
There is Prices periodical (days) information register:
Dimensions:
Item
Counterparty
Resources:
Price

I need too get best prices for the current day and counterparties which sell with this price. Have no idea how to do this.

 
#2
People who like this:0Yes/0No
Active user
Rating: 3
Joined: Nov 1, 2011
Company:

Try something like this

Code
SEL ECT
   PricesSliceLast.Item,
   PricesSliceLast.Counterparty,
   PricesSliceLast.Price
FROM
   InformationRegister.Prices.SliceLast AS PricesSliceLast
      INNER JOIN (SELECT
         PricesSliceLast.Item AS Item,
         MIN(PricesSliceLast.Price) AS MinPrice
      FR OM
         InformationRegister.Prices.SliceLast AS PricesSliceLast
      
      GROUP BY
         PricesSliceLast.Item) AS MinPriceTable
      ON PricesSliceLast.Item = MinPriceTable.Item
         AND PricesSliceLast.Price = MinPriceTable.MinPrice

 
#3
People who like this:0Yes/0No
Active user
Rating: 5
Joined: Sep 27, 2011
Company:

Thank you, Alexey! This works very good!

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.