Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find records w certain criteria and records between them 1

Status
Not open for further replies.

kernal

Technical User
Feb 27, 2001
415
US
I hope I can explain what I need and I added in this message all information needed.

Table data

ip_address date time path

152.132.10.22 02/09 12:48:07 email=feb9
152.132.10.22 02/09 12:49:15 advisor
152.132.10.22 02/09 13:58:04 confirm.html

155.97.35.89 02/09 10:59:23 email=feb22

198.50.4.54 02/10 08:44:31 eval
198.50.4.54 02/10 10:40:00 email=feb9
198.50.4.54 02/14 13:18:14 advisor
198.50.4.54 02/15 14:23:12 email=feb11
198.50.4.54 02/16 17:14:40 confirm.html
198.50.4.54 02/17 08:46:05 cart

1. I need to find any ip_addresses where in the path is "email=feb9" with also a record "confirm.html."

2. AND any records created between the "email=feb9" and "confirm.html" so my results would be:

ip_address date time path

152.132.10.22 02/09 12:48:07 email=feb9
152.132.10.22 02/09 12:49:15 advisor
152.132.10.22 02/09 13:58:04 confirm.html

198.50.4.54 02/10 10:40:00 email=feb9
198.50.4.54 02/14 13:18:14 advisor
198.50.4.54 02/15 14:23:12 email=feb11
198.50.4.54 02/16 17:14:40 confirm.html

Help is very appreciated. Thank you
 
I think it just takes joining the table to itself a couple of times. For simplicity, lets assume the date and time are stored in a single date column.
Code:
select distinct jt3.ip_address, jt3.page, jt3.creation_date from josh_test jt1, josh_test jt2, josh_test jt3
where jt1.ip_address= jt2.ip_address and jt1.page='email=feb9' and jt2.page='confirm.html' and jt3.ip_address=jt2.ip_address and jt3.creation_date between jt1.creation_date and jt2.creation_date order by jt3.creation_date

-----------------------------------------
I cannot be bought. Find leasing information at
 
jaxtell, Wonderful! Wonderful! thank you so much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top