Here is the scenario I have Customers that called in and create helpdesk ticketno and I need to create a query that show the same customer who created 2 or more tickets withthin the 30 days period and showed the last Ticketno and last createdate.There are 2 tables and 3 fields invloved the Customer.custid,Ticket.createdate,Ticket.ticketno.Any ideas ? Below is my example but the syntaxs are wrong. Please help.Thanks.
select count(*),a.custid, b.createdate from ticket a, customer b where
a.custkey =b.custkey
and DATEDIFF(Day,Max(a.CREATEDATE),GETDATE())= 30)
group by b.custid
Having Count(*) > 1
select count(*),a.custid, b.createdate from ticket a, customer b where
a.custkey =b.custkey
and DATEDIFF(Day,Max(a.CREATEDATE),GETDATE())= 30)
group by b.custid
Having Count(*) > 1