我有三个表,分别用于产品,销售和购买。产品与销售相关,也与购买相关。
如何使用Codeigniter生成如上所示的视图?
'npm' is not recognized as an internal or external command,
operable program or batch file.
答案 0 :(得分:0)
类似的事情应该起作用。请注意,我使用的是表中所示的情况,因此您应该根据需要进行调整。
$this->db->select('Product.id, Product.Name, Sells.Pid AS Spid, Sells.Items_sold, Sells.Date AS Sells_date');
$this->db->select('Purchased.Pid, Purchased.Items_purchased, Purchased.date AS Purchased_date');
$this->db->from('Product');
$this->db->join('Sells', 'Product.id = Sells.Pid');
$this->db->join('Purchased', 'Product.id = Purchased.Pid');
$query = $this->db->get();