-
Junior Member
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....
-
Administrator
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..
-
Contributing Member
Re: how to do this
The above query should work. Plz also make sure the field orderdate is of type Date.
-
Junior Member
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
-
Junior Member
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
-
Forum Rules