2.2 DISTINCT

 

Find products that are sold 5 pieces at one time, and their prices and units:

SQL

SELECT DISTINCT ProductID,Price,Unit
FROM Orders
WHERE Quantity>=5

SPL

A
1 =file(“Orders.ctx”).open().cursor@x(ProductID,Price,Unit;Quantity>=5)
2 =A1.groups(ProductID,Price,Unit)

A2 groups function is equivalent to DISTINCT when it doesn’t have an aggregate expression.