Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014

    Question Unanswered: List function with Sum?

    I have a subquery that retunrns multiple lines. To solve it, I have used the List function. The separation of List function is comma.

    TblBill is in the main query with many other tables.
    (Select List(tblBatch.batchnr) From tblBatch where tblBatch.tr_id = tblBill.kfr_trans_id ) As Batchnr

    This subquery returns: B12, B13, B14, B43 and so on...

    Now I want to use SUM from another field (quant) from table tblBatch in the subquery and then separate those with a line break instead of comma.
    Batch number may occur several times and I want to summarize these

    I want the subquery return like this:

    3 B12
    4 B13
    1 B14
    1 B43

    and so on..

    How do I solve it the best way?

  2. #2
    Join Date
    May 2005
    South Africa
    Provided Answers: 1
    Your query is incomplete. Maybe you want:
    SELECT sum_quant=sum(quant), batchnr From tblBatch GROUP BY batchnr

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts