• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DB Query Question

#3
(12-05-2018, 03:54 AM)neuron Wrote:
(12-05-2018, 03:15 AM)soneax Wrote: ID     Name     Refer_id
1       John       2
2       Alex        3
3       Peter       1

PHP Code:
$this->db->select('u.*, u2.name as referrer_name')
->
from('user u')
->
join('user u2''u2.id = u.refer_id''left')
->
where('u.id'$user_id);

$result $this->db->get(); 

Got it! Appreciated Smile
Reply


Messages In This Thread
DB Query Question - by soneax - 12-05-2018, 03:15 AM
RE: DB Query Question - by neuron - 12-05-2018, 03:54 AM
RE: DB Query Question - by soneax - 12-05-2018, 05:19 AM
RE: DB Query Question - by soneax - 12-05-2018, 05:40 AM
RE: DB Query Question - by neuron - 12-05-2018, 11:18 PM
RE: DB Query Question - by soneax - 12-06-2018, 04:31 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.