Hi All,
I need to build a report which is showing client who did not order since particular period, but have ordered within the past 3 months.
Is anyone can help me to understand the technique to get that data?
Thanks in advance.
hi Ron,
you need help in query or designing the reports.
query i think will be like this
select CustomerName from Customers Where CustomerId not in (select distinct customerid from Orders where OrdDate between @.fromdt and @.todt)
and CustomerId in (Select distinct customerid from Orders where orddate betwen getdate() and dateadd(m,-3,getdate())
hope it works.
regards,
satish
|||Thanks Satish,
It works.
|||Hi Satish,
Now my problem is that I want just showing the customer with the last invoice date. So something like this:
CustName Inv.Date
MER01 09/06/2006
JUN01 09/30/2006
Right now, I got multiple item with the same customer since their invoice date is different. I try using MAX(InvoiceDate), but
it seems did not work out.
Any idea...
|||I solved the problem. Thanks.|||hi ronn
see if following helps out in case you want separate query if you want with earlier one let me know but first try if you can fight a bit on your own :)
select top 1 CustomerName, InvDate from Customers Inner Join Invoice on Invoice.CustomerID = Customer.CustomerID
group by CustomerName, InvDate
order by InvDate Desc
regards,
satish
No comments:
Post a Comment