score:2

Accepted answer
var result = db.tblprocessorlists.groupjoin(  // groupjoin processors and transactions
    db.tbltransactions,
    processor => processor.userid,       // from every processor take the userid
    transaction => transaction.userid,   // from every transaction take the userid

    // resultselector: use eacht processor with its zero or more matching transactions
    // to make one new object
    (processor, transactionsofthisprocessor) => new
    {
        processor = processor,

        // group all transactionsofthisprocessor into groups with same [year, month]
        // and sum the values of all transactions in each group
        transactiontotals = transactionsofthisprocessor
            .groupby(transaction => new 
            {
                year = transaction.year,       // keyselector: make groups with 
                month = transaction.month      // same [year, month]
            },

            // element selector: transaction.value
            transaction => transaction.value,

            // resultselector: key = [year, month],
            // elements are all values of this [year, month] group
            // sum all values
            (key, valueswiththisyearmonth) => new
            {
                year = key.year,
                month = key.month,
                total = valueswiththisyearmonth.sum(),
            }),
    });

Related Query

More Query from same tag