July 17, 2014 at 4:56 am
Check this one
declare @IPaddresses TABLE ([IPAddress] VARCHAR(20),[dte] [smalldatetime])
-- Inserting Data into Table
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('86.148.129.66','20-jun-2014 13:00:00')
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('86.148.129.66','20-jun-2014 13:30:00')
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('86.148.129.66','20-jun-2014 14:00:00')
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('81.222.435.80','20-jun-2014 14:30:00')
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('81.222.435.80','20-jun-2014 15:00:00')
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('81.222.435.80','20-jun-2014 15:30:00')
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('81.222.435.80','20-jun-2014 16:00:00')
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('66.113.165.99','20-jun-2014 16:30:00')
INSERT INTO @IPaddresses(IPAddress,dte)
VALUES('86.148.129.66','21-jun-2014 14:00:00')
select distinct IPAddress, min(dte)
from @IPaddresses
group by IPAddress, convert(date,dte)
Order by min(dte)
Hope it helps
July 17, 2014 at 5:08 am
That's exactly what I needed, thank you very much. Have a good day
July 17, 2014 at 5:57 am
Glad to help
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply