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