I'm using CodeIgniter's Active Record Classes and I'm retrieving an error using the following code:
$this->db->select("*");
$this->db->order_by("id");
$this->db->limit($limit, $offset);
$this->db->from("atoms");
$this->db->join("atommeta", "atommeta.atom_id = atoms.atom_id");
$query = $this->db->get();
It produces this error:
Error Number: 1052
Column 'id' in order clause is ambiguous
SELECT * FROM (`atoms`) JOIN `atommeta` ON `atommeta`.`atom_id` = `atoms`.`atom_id` ORDER BY `id` LIMIT 10
Filename: /Applications/MAMP/htdocs/atom/models/atom_model.php
Line Number: 197
Line 197: $query = $this->db->get();
Any ideas as to why? It seems to be something to do with the order_by
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…