Plugin

Archived
Forum
(read-only)


For official support, visit the official support site »

Active Record

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Rob Sanchez

     

query issue

General

interface
interface

Hi Rob
I have set up this query and it is running just fine in sql manager and sequel pro:

SELECT SUM(field_id_2+field_id_3+field_id_4+field_id_5+field_id_6+field_id_7)/(6*(SELECT COUNT(entry_id
                    
FROM exp_channel_titles WHERE channel_id="1" AND status="final"))
                    
FROM exp_channel_data 
                    WHERE entry_id IN 
(SELECT entry_id 
                    FROM exp_channel_titles 
                    WHERE status
="final"); 

(its calculating the averages across entries of certain field_ids filtered by status and group_id)
For some reason it breaks in the native query module.
Would it be possible to convert this query in active record plugin?

Cheers
Christian

interface
# 1
interface

Hi Rob
solved the issue.
Cheers

Rob Sanchez
# 2
Developer
Rob Sanchez

Just a note for anyone else reading this thread: subqueries are not possible in CodeIgniter’s activve record class.