【问题标题】:codeigniter mysql active recordcodeigniter mysql 活动记录
【发布时间】:2011-10-05 06:59:21
【问题描述】:
SELECT COUNT( * ) AS  numrows 
FROM (
books
)
WHERE (
id_status =1
OR id_status =2
)
AND  company =2

如何转换为 CI Active Record?

【问题讨论】:

    标签: php mysql codeigniter activerecord


    【解决方案1】:
    $this->db->select('count(*) as numrows')->from('books ')->where("(id_status='1' OR id_status='2') and company ='2'")
    

    【讨论】:

    • 如果结果足够可以用count_all_results代替select,可以将where拆分成两部分。
    猜你喜欢
    • 2011-02-28
    • 2012-01-23
    • 1970-01-01
    • 2011-02-22
    • 2011-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-22
    相关资源
    最近更新 更多