Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. $sql = "
  2. SELECT default_mailsystem.*,
  3. recipent.first_name AS modtager,
  4. sender.first_name AS afsender
  5.  
  6. FROM default_mailsystem
  7.  
  8. LEFT JOIN default_profiles AS recipent
  9. ON recipent.id = default_mailsystem.id
  10.  
  11. LEFT JOIN default_profiles AS sender
  12. ON sender.id = default_mailsystem.id
  13. ";
  14. return $this->db->query($sql)->result();
  15.  
  16. Not unique table/alias: 'default_users'
  17.  
  18. SELECT `default_mailsystem`.*, `default_users`.`username` AS modtager, `default_users`.`username` as afsender FROM (`default_mailsystem`) LEFT JOIN `default_users` ON `default_mailsystem`.`recipent` = `default_modtager`.`id` LEFT JOIN `default_users` ON `default_mailsystem`.`sender` = `default_afsender`.`id` ORDER BY `id` DESC
  19.  
  20. Filename: /hsphere/local/home/brightmedia/reuseable.dk/modules/mail/models/mail_m.php
  21.  
  22. Line Number: 13
  23.  
  24. $this->db->select('mailsystem.*, users.username AS modtager, users.username as afsender')
  25. ->join('users', 'mailsystem.recipent = modtager.id', 'left')
  26. ->join('users', 'mailsystem.sender = afsender.id', 'left');
  27. $this->db->order_by('id', 'DESC');
  28. return $this->db->get('mailsystem')->result();
  29.  
  30. $this->db->select('mailsystem.*, users.username AS modtager, users.username as afsender')
  31. $this->db->join('users', 'mailsystem.recipent = modtager.id AND mailsystem.sender = afsender.id', 'left')
  32. $this->db->order_by('id', 'DESC');
  33. return $this->db->get('mailsystem')->result();
  34.  
  35. <?php
  36. $this->db->select('mailsystem.*, modtager.username AS modtager_name, afsender.username as afsender_name')
  37. ->join('`users` `modtager`', 'mailsystem.recipent = modtager.id', 'left')
  38. ->join('`users` `afsender`', 'mailsystem.sender = afsender.id', 'left');
  39.  
  40. $this->db->order_by('mailsystem.id', 'DESC');
  41.  
  42. return $this->db->get('mailsystem')->result();
  43.  
  44. $this->db->select('mailsystem.*, users.username AS modtager, users.username as afsender')
  45. $this->db->join('users', 'mailsystem.recipent = modtager.id AND mailsystem.sender = afsender.id', 'left')
  46. $this->db->order_by('id', 'DESC');
  47. return $this->db->get('mailsystem')->result();
  48.  
  49. $this->db->select('mailsystem.*, users.username AS modtager, users.username as afsender')
  50. $this->db->join('users', 'mailsystem.recipent = modtager.id AND '.$this->db->dbprefix('mailsystem').'.sender = '.$this->db->dbprefix('afsender').'.id', 'left')
  51. $this->db->order_by('id', 'DESC');
  52. return $this->db->get('mailsystem')->result();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement