Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2014
    Posts
    4

    Unanswered: Sum Of count of columns

    hi All,
    I need to write a query in mysql that is ,I want to sum all the values those are retrived by Count .

    i am writing following query

    Select SUM(ReceivedAmt) AS TOTALAMOUNT, count(TID0) AS ITEM1,count(TID0) AS ITEM2 ,Sum(ITEM1 +ITEM2 )AS Items from tbldiagnostics where date(TOT)='2014-07-07';

    Please help me
    Thanks & Regards,
    vishnu123

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    do you mean?
    Code:
    count(TID0) AS ITEM1,count(TID0) AS ITEM2 ,count(TID0) +count(TID0) AS Items
    seems a little odd adding the same value to itself and to count the same value twice, I will give you the benefit of the doubt and say you just have a typo.
    Dave

  3. #3
    Join Date
    Jul 2014
    Posts
    4
    Thanks for reply,I got answer

Posting Permissions

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