Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Need Help In Query:

Need Help In Query:

Scheduled Pinned Locked Moved Database
databasehelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shahzad Aslam
    wrote on last edited by
    #1

    Hi select CAST((datediff(day,createdon,getdate())/30) as float) Avg, from customers I want to give the result in Fraction is it possible? it is not showing the fraction result. createdon is the datetime field Any Help is appreciated. Regards Shahzad Aslam Software Engineer

    K 1 Reply Last reply
    0
    • S Shahzad Aslam

      Hi select CAST((datediff(day,createdon,getdate())/30) as float) Avg, from customers I want to give the result in Fraction is it possible? it is not showing the fraction result. createdon is the datetime field Any Help is appreciated. Regards Shahzad Aslam Software Engineer

      K Offline
      K Offline
      Krish KP
      wrote on last edited by
      #2

      datediff function's date part "day" returns difference in number of days i.e 1 / 2 / 3 ..... if u r looking for even part of day, get the difference in hours/minutes/ ... then try converting that to days so that you get the result as you are expecting

      Regards KP

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups