Results 1 to 5 of 5

Thread: how to do this

  1. #1
    Junior Member
    Join Date
    Mar 2007
    Answers
    1

    how to do this

    hi all i am pradeep,

    i am new to sql server,
    i have one quetion for u experts.

    i have a table called "orders_detail" i will show the structure of the table.

    orders_detail
    1.customerid 2.orderid 3.orderdate 4.no_of_items
    these are the columns i have...

    i want to retrive customerid of those people who have not ordered from last six months.i have tried date difference function but i am getting problems in that... pls help....


  2. #2
    Administrator
    Join Date
    May 2006
    Answers
    331

    Re: how to do this

    I did not execute this but should work ...

    select customerid from orders_detail where
    convert(varchar,orderdate,101) not between
    ((DATEDIFF(Month,6,GETDATE()) and getdate())

    if this does not work, let me know .. I will be accessing sql server later today..


  3. #3
    Contributing Member
    Join Date
    Apr 2007
    Answers
    58

    Re: how to do this

    The above query should work. Plz also make sure the field orderdate is of type Date.


  4. #4

    Re: how to do this

    Sorry Admin,didn't get the datediff() thing..why compare a number with date.
    'coz datediff() will return a number in your case..right !!


    select customerid from orders_detail where
    orderdate not between
    ((DATEADD("Month",-6,GETDATE()) and getdate())

    NOTE: Use convert function for orderdate if your datatype is varchar


  5. #5
    Junior Member
    Join Date
    May 2007
    Answers
    1

    Re: how to do this

    Hi friends i want some detail information about "BOUNDARY VALUE ANALYSIS "


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact