Jump to content

Archived

This topic is now archived and is closed to further replies.

neilmunn

Grouping results based on internal?

Recommended Posts

I have in a database which stores insurance quote requests.

I want 2 queries that count the number of quotes by each referrer, grouping quotes made within a 10 minute period as 1 quote

Here is an example of the table and the wanted results.
TABLE
ID referrer type time ip
1 XADW0124 MC 1161683434 82.7.164.59
2 XADW0124 MC 1161683464 82.7.164.59
3 XADW0124 MC 1161683484 82.7.164.59
4 XADW0124 PC 1161684425 62.173.110.62
5 XADW0139 MC 1161685322 195.137.84.105

RESULT
ID  referrer      type  time            ip
3    XADW0124  MC    1161683484  82.7.164.59
4    XADW0124  PC    1161684425  62.173.110.62
5    XADW0139  MC    1161685322  195.137.84.105

AND
Referrer        Num Quotes Filtered      Num Quotes Unfiltered
XADW0124    2                                4
XADW0139    1                                1

Thanks for the help,
Neil

Share this post


Link to post
Share on other sites
Intersting question... if it were by day/month, this would be relatively easy, since you could either use a sub-query or use a derived table; however, I'm stumped on how to generate 10-minute period bins... maybe with a self-join?  I'll have to think about it.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.