Jump to content

Zend Framework DB Table Abstract


stublackett

Recommended Posts

Hi Guys,

 

I've hit a bit of a brick wall in converting an SQL Query into a suitable ORM Query

 

The query is pretty complex even in SQL Terms, But I am looking at ways of collating this into an ORM Query, as I'm converting a lot of functions I've produced in Flex into Zend Framework Models for future proofing and API Purposes.

 

The current flat SQL is as follows :

 

SELECT subcategory_id, 
SUM(total) / (1+(YEAR(2011)*12+MONTH(1))-(YEAR(2011)*12+MONTH(12)))		 
AS monthly_average FROM aggr_subcategory WHERE user_id=1 AND month BETWEEN 01 AND 05 
	 GROUP BY user_id, subcategory_id

 

The main issues I am having are the SUM, I can manage the GROUP and WHERE clauses in ORM, but cannot get the sum in the DB Table Abstract.

 

Any help or points in the right direction much appreciated.

Link to comment
https://forums.phpfreaks.com/topic/241893-zend-framework-db-table-abstract/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.