Consulta SQL para CI Consulta Builder online
SELECT*FROM product LIMIT 0, 4;
Graceful Grebe
SELECT*FROM product LIMIT 0, 4;
select('users.designation_id,users.guid, users_org_mapping.user_id,users.active,
roles.title AS role,users_org_mapping.role_id,users.display_name,organizations.name,
organizations.status,users.session,users_org_mapping.organization_id,users.created_on,users.wallet_model')
->join('users','users.id=users_org_mapping.user_id','inner')
->join('musers', 'users.guid=md5(musers.id)', 'inner')
->join('roles', 'roles.id=users_org_mapping.role_id', 'inner')
->join('organizations', 'organizations.id=users_org_mapping.organization_id', 'inner')
->where('musers.username',$username_decrpt,FALSE)
->find_all();
select('users.designation_id,users.guid, users_org_mapping.user_id,users.active,
roles.title AS role,users_org_mapping.role_id,users.display_name,organizations.name,
organizations.status,users.session,users_org_mapping.organization_id,users.created_on,users.wallet_model')
->join('users','users.id=users_org_mapping.user_id','inner')
->join('musers', 'users.guid=md5(musers.id)', 'inner')
->join('roles', 'roles.id=users_org_mapping.role_id', 'inner')
->join('organizations', 'organizations.id=users_org_mapping.organization_id', 'inner')
->where('musers.username',$username_decrpt,FALSE)
->find_all();
SELECT("users.display_name");
->WHERE('n.organization_id', "383" );
->FROM( "users_org_mapping" . ' AS n')
->JOIN('users', 'users.id = n.user_id', 'inner')
->FROM( "users_org_mapping" . ' AS p')
->WHERE('n.lft BETWEEN p.lft AND p.rgt')
->WHERE('p.user_id', 26997 )
->WHERE('p.role_id', 30 )
->WHERE('p.organization_id', 383 )
->group_by('n.user_id')
->order_by('n.lft');
select('users.designation_id,users.guid, users_org_mapping.user_id,users.active,
roles.title AS role,users_org_mapping.role_id,users.display_name,organizations.name,
organizations.status,users.session,users_org_mapping.organization_id,users.created_on,users.wallet_model')
->join('users','users.id=users_org_mapping.user_id','inner')
->join('musers', 'users.guid=md5(musers.id)', 'inner')
->join('roles', 'roles.id=users_org_mapping.role_id', 'inner')
->join('organizations', 'organizations.id=users_org_mapping.organization_id', 'inner')
->where('musers.username',$username_decrpt,FALSE)
->find_all();
select('users.designation_id,users.guid, users_org_mapping.user_id,users.active,
roles.title AS role,users_org_mapping.role_id,users.display_name,organizations.name,
organizations.status,users.session,users_org_mapping.organization_id,users.created_on,users.wallet_model')
->join('users','users.id=users_org_mapping.user_id','inner')
->join('musers', 'users.guid=md5(musers.id)', 'inner')
->join('roles', 'roles.id=users_org_mapping.role_id', 'inner')
->join('organizations', 'organizations.id=users_org_mapping.organization_id', 'inner')
->where('musers.username',$username_decrpt,FALSE)
->find_all();
SELECT b.*,
keluar.jumlah as keluar,
masuk.jumlah as masuk
FROM barang b
LEFT JOIN ( SELECT kd.id_barang, SUM(kd.jumlah) AS jumlah
FROM transaksi_keluar_detail kd
LEFT JOIN transaksi_keluar_header kh ON kh.id_keluar_header=kd.id_keluar_header
WHERE kh.id_cabang = 'C01' AND monthname(kh.date) = 'February'
AND year(kh.date) = '2022'
GROUP BY kd.id_barang
) keluar ON b.id_barang = keluar.id_barang
LEFT JOIN ( SELECT md.id_barang, SUM(md.jumlah) AS jumlah
FROM transaksi_masuk_detail md
LEFT JOIN transaksi_masuk_header mh ON mh.id_masuk_header=md.id_masuk_header
WHERE mh.id_cabang = 'C01' AND monthname(mh.date) = 'February'
AND year(mh.date) = '2022'
GROUP BY md.id_barang
) masuk ON b.id_barang = masuk.id_barang
ORDER BY b.id_barang