[英]Write Subqueries in Code Igniter
Hello everyone i need a help for writing subqueries on Code Igniter i always fail if i'm using db active record. 大家好,我需要在Code Igniter上编写子查询的帮助,如果我使用db活动记录,我总是会失败。
Queries that i want to run is 我要运行的查询是
select ( alias_a.field_a + alias_b.field_b ) as total_a from
( select sum(field_a) as TOTAL_SUM, status, date from table_a
where status ='ok'
group by year(date)) as alias_a ,
(select sum(field_b) as total_b, status, date from
table_b where
status = 'good' group by year(date)) as alias_b
where year(alias_a.date) = year(alias_b.date)
this queries has run on sql editor 此查询已在sql编辑器上运行
i have tried $this->db->query('my query')
but it has error 我试过
$this->db->query('my query')
但有错误
any info will helping me so much. 任何信息都会对我有很大帮助。 Thanks !
谢谢 ! :)
:)
Hi please check quotation marks in CI. 您好,请检查CI中的引号。 could you post the exact code implemented in CI query as is so we could see the problem.
您能否按原样发布在CI查询中实现的确切代码,以便我们看到问题。
thanks ( = 谢谢(=
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.