Guest User

Untitled

a guest
May 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. SELECT
  2. t.created_at,
  3. from_user.email_address as purchaser_email_address,
  4. t.purchaser_id as purchaser_user_id,
  5. to_user.email_address as to_email_address,
  6. user_photo.filename as photo_url
  7.  
  8. FROM item_transactions t
  9.  
  10. INNER JOIN `items` as i on t.item_id = i.id
  11. INNER JOIN `users` AS from_user ON t.purchaser_id = from_user.id
  12. INNER JOIN `users` as to_user ON t.user_id = to_user.id
  13. INNER JOIN `profiles` as to_user_profile ON t.user_id = to_user_profile.user_id
  14. INNER JOIN `photos` as user_photo ON to_user_profile.default_photo_id = user_photo.id
  15.  
  16. WHERE t.result = 1 AND (t.user_id = 1 OR t.purchaser_id = 1);
Add Comment
Please, Sign In to add comment