Wednesday, 15 February 2012

recursive query - how to retrieve rows based on more than one common identifier in SQL -


I have a user log in log table with cookies, IPs, emails and other data details. A user can visit more than one IP, separate cookie ID, or even leave a different email. I want to retrieve all the log events of any specific identifier, such as any common identifier based, like:

  Row cookie IIP IP 1: 1 10.0.0.12 D @ M.com 2: 2 10.0.0.12 h@m.org // matches the # 1 based on the usual IP3: 1 1 9 2 .168.1.1 Blank / Common Cookie ID 4: 3 192.168.2.2 R @ Match # based on Y Com // Common cookies 5: 3 10.11.12.13 H @ MORG / mail based # 2 for match based on match for # 5   

I need to find a way to recover All the rows in this case, because at all times they are related to all email or cookie ID or IP

Anyone know how to implement efficiently?

Try it out:

  t1.row, t2.row Select, CookieId = t2.cookieId or t1.email = t2.email or t1.ip = t2.ip where t1.row! = T2.row    

No comments:

Post a Comment