如何使用join righ ?????
将简单查询写入codeigniter查询$query = $this->db->query("Select staff_permissions_list.perm_type,staff_permissions_list.permission_key,staff_permissions_list.permission_label,
staff_permissions_list.id, staff_role_permissions.permission_id as p_id,staff_role_permissions.role_id
FROM staff_role_permissions
RIGHT JOIN staff_permissions_list ON staff_role_permissions.permission_id=staff_permissions_list.id
AND staff_role_permissions.role_id=$id WHERE staff_permissions_list.perm_type=0
ORDER BY staff_permissions_list.id ASC
");
if ($query->num_rows() > 0) {
return $query->result_array();
}
答案 0 :(得分:0)
$this->db->select('book_id, book_name, author_name, category_name');
$this->db->from('books');
$this->db->join('category', 'category.category_id = books.category_id', 'right');
$query = $this->db->get();
您可以使用右连接方法获取数据
答案 1 :(得分:0)
那怎么样?
interface MyFunctionType { (resource: string | Resource): Something }
// a Mapped Type to fix methods, used in place of a interface
type FixedMethods<T extends string> = {
[k in T]: MyFunctionType
}
class MyClass implements FixedMethods<"someMethodThatConforms" | "anotherMethodThatConforms"> {
someMethodThatConforms(resource: string | Resource) {
// this method will fail type check, until we return a Something
return 1;
}
// it also complains about lack of "anotherMethodThatConforms" method
}
我将role_id放到where部分 - 也许你需要把它放回去(不知道你想在这里实现什么)