Posted By

kayue on 12/31/10


Tagged


Versions (?)

Social Engine


 / Published in: SQL
 

  1. #
  2. SELECT `user_id` FROM `engine4_invites` GROUP BY `user_id`
  3.  
  4. # User 1 invited ...
  5. SELECT users.`user_id`,`displayname`, `email` FROM `engine4_invites` invites
  6. JOIN `engine4_users` users ON invites.`new_user_id` = users.`user_id`
  7. WHERE invites.`user_id` = 1
  8.  
  9. # User 1 was invited by ...
  10. SELECT users.`user_id`,`displayname`, `email` FROM `engine4_invites` invites
  11. JOIN `engine4_users` users ON invites.`user_id` = users.`user_id`
  12. WHERE `new_user_id` = 1
  13.  
  14. # Never registered
  15. SELECT users.`user_id` 'Invited by (id)',`displayname` 'Invited by (name)', `recipient`, `code` FROM `engine4_invites` invites
  16. JOIN `engine4_users` users ON invites.`user_id` = users.`user_id`
  17. WHERE `new_user_id` = 0

Report this snippet  

You need to login to post a comment.