I wouldn’t expect it to perform well with a large record set, but try:
ExecuteSQL ( "SELECT DISTINCT ID
FROM Products b
WHERE Price = (
FROM Products a
WHERE a.Product = b.Product
You didn’t specify what should happen if multiple products with the same Product value have the same minimum price. This query would return the ID values of all such products.
you can solve that with FETCH FIRST ROW ONLY
Anyway, I prefer a self relationship, a field MinPrice defined as Min (self::Price) and a eSQL with WHERE productPrice = MinPrice
1 of 1 people found this helpful
DISTINCT wouldn't need if ID is really ID (primary key in the table).