QuerySpec - Multiplying in a GroupBy

Posts   
 
    
gabrielk avatar
gabrielk
User
Posts: 231
Joined: 01-Feb-2005
# Posted on: 06-May-2014 16:21:14   

Hi All,

Just started to work with QuerySpec, great tool for what we're trying to achieve in retrieval queries for analytics on our data.

I wondered how you can select multiplied fields using QuerySpec, i.e.:

SUM(Orderitem.Quantity * OrderItem.Price) as Revenue

I've search for 'queryspec multiply' but couldn't find anything.

Thanks.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-May-2014 07:44:56   

There is an example here in the documentation. You can just specify the fields in the expression:

.Select(OrderItemFields.Quantity * OrderItemFields.Price)
                    .Sum().As("OrderTotal")
David Elizondo | LLBLGen Support Team
gabrielk avatar
gabrielk
User
Posts: 231
Joined: 01-Feb-2005
# Posted on: 07-May-2014 08:28:03   

rage Missed that one in the documentation, thanks.