Advertisement
Guest User

Untitled

a guest
May 16th, 2017
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. LOG table
  2.  
  3. userid action time
  4.  
  5. 18 login 556565686
  6. 14 logout 878787878
  7. 9 login 323232323
  8.  
  9. USER table
  10.  
  11. id username email userid
  12.  
  13. 9 ram sample@sample.ocm 9
  14. 13 sunil temp@temp.com 13
  15. 14 david david@david.com 14
  16. 18 gopal gopal@sample.com 18
  17.  
  18. ========================================================================
  19. Select * from USER INNER JOIN LOG ON USER.id = LOG.userid AND LOG.userid = 'login';
  20.  
  21. will result
  22.  
  23. id username email userid
  24.  
  25. 9 ram sample@sample.ocm 9
  26. 18 gopal gopal@sample.com 18
  27.  
  28.  
  29. but i want
  30.  
  31. id username email time
  32.  
  33. 9 ram sample@sample.ocm 323232323
  34. 18 gopal gopal@sample.com 556565686
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement