Extract datas

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kazper
    New Member
    • Jan 2007
    • 15

    Extract datas

    Good day,

    I'm trying to extract some data from our database. I just need to get the list of persons that will be having 5 or 10 months on their contract this coming month.


    Thanks in advance.
  • azimmer
    Recognized Expert New Member
    • Jul 2007
    • 200

    #2
    Originally posted by kazper
    Good day,

    I'm trying to extract some data from our database. I just need to get the list of persons that will be having 5 or 10 months on their contract this coming month.


    Thanks in advance.
    It is way too little information for us to help. Please include:
    • the structure of your relevant tables
    • a field-wise description of what you need
    • example, perhaps
    • the point where you've got by yourself

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      How about:
      [code=sql]
      SELECT
      *
      FROM
      tablename
      WHERE
      DATEDIFF(MONTH, GETDATE(), datefield) = 5
      OR DATEDIFF(MONTH, GETDATE(), datefield) = 10
      [/code]

      Comment

      Working...