Saturday, 23 February 2019

Mysql Query for Aging To Count No of records


Here is query and output


SELECT
         SUM(CASE WHEN TO_DAYS(CURDATE()) - TO_DAYS(DOS) BETWEEN 1 AND 30 THEN 1 ELSE 0 END) AS age130,
         SUM(CASE WHEN TO_DAYS(CURDATE()) - TO_DAYS(DOS) BETWEEN 31 AND 60 THEN 1 ELSE 0 END) AS age3160,
         SUM(CASE WHEN TO_DAYS(CURDATE()) - TO_DAYS(DOS) BETWEEN 61 AND 90 THEN 1 ELSE 0 END) AS age6190,
         SUM(CASE WHEN TO_DAYS(CURDATE()) - TO_DAYS(DOS) BETWEEN 91 AND 120 THEN 1 ELSE 0 END) AS age91120,
         SUM(CASE WHEN TO_DAYS(CURDATE()) - TO_DAYS(DOS) > 120 THEN 1 ELSE 0 END) AS agegt120
  from encounter where claimNo is null

7 comments:

  1. Thank you for this post. Thats all I are able to say. You most absolutely have built this blog website into something speciel. You clearly know what you are working on, youve insured so many corners.thanks
    Laptop service centre in chennai
    HP laptop service center in chennai
    Laptop display replacement in chennai
    Laptop Water damage service in chennai
    Macbook pro Water damage service in chennai
    Laptop screen replacement in chennai

    ReplyDelete
  2. great articloe man keep doing the good work ajay devgan six packs

    ReplyDelete
  3. I am quit very surprised with your post, its too good team, thanks for sharing this information. i am from Delhi eye centre we having best eye surgeons for cataract surgery, Lasik surgery, cornea surgery, glaucoma surgery, Retina Surgery, Squint Surgery ICL Surgery and etc.

    ReplyDelete
  4. Get solution for all major Life, Love, Marriage Problems, and Husband Wife Dispute. Contact World’s Best Astrologer Desraj Sharma He offers astrology service for your all types of problem like Business Growth, Job Issue, Visa, Horoscope etc.
    Childlessness Astrology
    Love Marriage Specialist
    Vastu Consultant
    Vashikaran
    Career Problem Solution
    Business Advisor

    ReplyDelete

EDI 837 P Budget Number Example