Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sql = "
- SELECT default_mailsystem.*,
- recipent.first_name AS modtager,
- sender.first_name AS afsender
- FROM default_mailsystem
- LEFT JOIN default_profiles AS recipent
- ON recipent.id = default_mailsystem.id
- LEFT JOIN default_profiles AS sender
- ON sender.id = default_mailsystem.id
- ";
- return $this->db->query($sql)->result();
- Not unique table/alias: 'default_users'
- 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
- Filename: /hsphere/local/home/brightmedia/reuseable.dk/modules/mail/models/mail_m.php
- Line Number: 13
- $this->db->select('mailsystem.*, users.username AS modtager, users.username as afsender')
- ->join('users', 'mailsystem.recipent = modtager.id', 'left')
- ->join('users', 'mailsystem.sender = afsender.id', 'left');
- $this->db->order_by('id', 'DESC');
- return $this->db->get('mailsystem')->result();
- $this->db->select('mailsystem.*, users.username AS modtager, users.username as afsender')
- $this->db->join('users', 'mailsystem.recipent = modtager.id AND mailsystem.sender = afsender.id', 'left')
- $this->db->order_by('id', 'DESC');
- return $this->db->get('mailsystem')->result();
- <?php
- $this->db->select('mailsystem.*, modtager.username AS modtager_name, afsender.username as afsender_name')
- ->join('`users` `modtager`', 'mailsystem.recipent = modtager.id', 'left')
- ->join('`users` `afsender`', 'mailsystem.sender = afsender.id', 'left');
- $this->db->order_by('mailsystem.id', 'DESC');
- return $this->db->get('mailsystem')->result();
- $this->db->select('mailsystem.*, users.username AS modtager, users.username as afsender')
- $this->db->join('users', 'mailsystem.recipent = modtager.id AND mailsystem.sender = afsender.id', 'left')
- $this->db->order_by('id', 'DESC');
- return $this->db->get('mailsystem')->result();
- $this->db->select('mailsystem.*, users.username AS modtager, users.username as afsender')
- $this->db->join('users', 'mailsystem.recipent = modtager.id AND '.$this->db->dbprefix('mailsystem').'.sender = '.$this->db->dbprefix('afsender').'.id', 'left')
- $this->db->order_by('id', 'DESC');
- return $this->db->get('mailsystem')->result();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement