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. I need query for the employees who joined a weak ago

I need query for the employees who joined a weak ago

Scheduled Pinned Locked Moved Database
databasetutorialquestion
4 Posts 4 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
    Satish Developer
    wrote on last edited by
    #1

    Hi, I have an employee table with employee data like empid, empname, empcreateddate. Every data new employees will join, so data is inserted in this table. I want to need reports weekly, to know, In this weak how many new employees are joined? How to do? can u give query for this? I am not getting the result, when i am using this below query Select * from Employees where EmpCreatedDate between convert(varchar,getdate(),101) and convert(varchar,getdate()-7,101)

    G. Satish

    S S 2 Replies Last reply
    0
    • S Satish Developer

      Hi, I have an employee table with employee data like empid, empname, empcreateddate. Every data new employees will join, so data is inserted in this table. I want to need reports weekly, to know, In this weak how many new employees are joined? How to do? can u give query for this? I am not getting the result, when i am using this below query Select * from Employees where EmpCreatedDate between convert(varchar,getdate(),101) and convert(varchar,getdate()-7,101)

      G. Satish

      S Offline
      S Offline
      Syed Mehroz Alam
      wrote on last edited by
      #2

      See date functions from msdn here[^] DateAdd, DatePart and GetDate will be there to help you. Regards, Mehroz

      1 Reply Last reply
      0
      • S Satish Developer

        Hi, I have an employee table with employee data like empid, empname, empcreateddate. Every data new employees will join, so data is inserted in this table. I want to need reports weekly, to know, In this weak how many new employees are joined? How to do? can u give query for this? I am not getting the result, when i am using this below query Select * from Employees where EmpCreatedDate between convert(varchar,getdate(),101) and convert(varchar,getdate()-7,101)

        G. Satish

        S Offline
        S Offline
        soni uma
        wrote on last edited by
        #3

        Try the following query Select * from Employees where EmpCreatedDate between select DATEADD(DAY, -(DATEPART(dw,GETDATE())-1),GETDATE()) and getdate() :cool:

        K 1 Reply Last reply
        0
        • S soni uma

          Try the following query Select * from Employees where EmpCreatedDate between select DATEADD(DAY, -(DATEPART(dw,GETDATE())-1),GETDATE()) and getdate() :cool:

          K Offline
          K Offline
          Khawar Abbas1
          wrote on last edited by
          #4

          Select * from YourTable where datediff( day, YourColumn, Getdate()) < 8

          Do good and have good.

          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