Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- callID userID time
- 1 15 xx:xx
- 1 16 xx:xx
- 2 15 xx:xx
- 2 16 xx:xx
- userID xtime status
- 15 xx:xx t
- 15 xx:xx f
- .
- .
- .
- .
- 16 xx:xx f
- 16 xx:xx t
- .
- .
- .
- .
- select q2.uid, q2.xtime,q3.status
- from
- (select uid,max(xtime) as xtime
- from table2
- --where xtime<time from table1!!!!!!
- group by uid
- ) q2
- left join table2 q3
- on q2.uid=q3.uid and q2.xtime=q3.xtime
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement