troubleshooting Question

SQL Query to Show data within 60 Days

Avatar of Saurabh Singh Teotia
Saurabh Singh TeotiaFlag for India asked on
22 Comments1 Solution474 ViewsLast Modified:
Hi All,

I'm trying to extract data from customer sales table where if the customer is placing sales for the first time it should show as Y basis of sales date but if the same customer return back within 60 days of sales date i want all the entries show as N,However if it returns > 60 days the entry should be Y.

Customer_ID	        Sales_Date
1	                        10-Jan-14
1	                        15-Jan-14
1	                        17-Mar-14
1	                         15-Apr-14

The answer that i'm looking for..

Customer_ID	          Sales_Date	        Answer
1	                          10-Jan-14	          Y
1	                          15-Jan-14	          N
1	                          25-Mar-14	          Y
1	                          15-Apr-14	          N

Robert Sherman

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 22 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros