429,558 Members | 1,373 Online
Need help? Post your question and get tips & solutions from a community of 429,558 IT Pros & Developers. It's quick & easy.

# Help with tricky query?

 P: n/a Or at least I find it tricky. :-) Assume we have three tables A, B and C. Table A contains a path and the distance for traveling that path: A (PathId, NodeId, Dist (from previous node)) 1, 1, 0 1, 2, 10 1, 3, 5 Table B contains observed data on path level: B (ObsId, PathId) 1, 1 2, 1 Table C contains observed data on node level (~12M rows): C (ObsId, NodeId, Time (from previous node)) 1, 1, 0 1, 3, 10 2, 1, 0 2, 3, 1 What should be observed here is that only nodes where the traveler stopped are observed i.e. the time for node 3 here is the time for traveling from node 1. What I would like to do is to filter out absurd observations in table B using the travel speed as condition. Something like: SELECT B.ObsId FROM JOIN... WHERE DIST / C.Time < SPEED_LIMIT The problem is to find out DIST. For me being a tired (for the moment) and rather inexperienced db programmer this seems a little bit tricky to solve but hopefully you guys and girls out there disagree. Oct 24 '06 #1