0
选择
p.id, p.name, p.code, clA.code为claCode, sclA.code为sclaCode, clB.code作为clbCode, sclB.code为sclbCode, clC.code为clcCode, sclC.code作为sclcCode
FROM
products p
INNER JOIN catleathers clA
ON p.catleather_id_a = clA.id
INNER JOIN subcatleathers sclA
ON p.subcatleather_id_a = sclA.id
INNER JOIN catleathers clB
ON p.catleather_id_b = clB.id
INNER JOIN subcatleathers sclB
ON p.subcatleather_id_b = sclB.id
INNER JOIN catleathers clC
ON p.catleather_id_c = clC.id
INNER JOIN subcatleathers sclC
ON p.subcatleather_id_c = sclC.id
但我需要这样的事
function getdatatableajaxcost()
{
$this->load->library('datatables');
$this->datatables
->select("
products.id as productid,
products.code as code,
products.name as name,
clA.code as claCode,
sclA.code as sclaCode,
clB.code as clbCode,
sclB.code as sclbCode,
clC.code as clcCode,
sclC.code as sclcCode,
products.details", FALSE)
->from('products')
->join('catleathers clA', 'products.catleather_id_a = clA.id', 'INNER')
->join('subcatleathers sclA', 'products.subcatleather_id_a = sclA.id', 'INNER')
->join('catleathers clB', 'products.catleather_id_a = clB.id', 'INNER')
->join('subcatleathers sclB', 'products.subcatleather_id_a = sclB.id', 'INNER')
->join('catleathers clC', 'products.catleather_id_a = clC.id', 'INNER')
->join('subcatleathers sclC', 'products.subcatleather_id_a = sclC.id', 'INNER')
->group_by("products.id");
$this->datatables->unset_column('productid');
$this->datatables->unset_column('image');
echo $this->datatables->generate();
请一定帮忙!
很难理解你在问什么。 – Rahul 2014-10-01 21:42:41
您是否试图将查询移植到其他语言? – Degustaf 2014-10-01 21:45:54
不是真的.. 我有一个数据表函数,我需要在里面添加更多的collumns。请看看上面编辑的。这在笨 – gatuso 2014-10-01 21:59:38