Re: Re: Question on Structures_DataGrid and field labels
| From: | Justin Patrin | Date: | Fri, 05 May 2006 16:11:50 +0000 |
| Subject: | Re: Re: Question on Structures_DataGrid and field labels | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23966@lists.php.net to get a copy of this message | ||
On 5/5/06, Mark Wiesemann <wiesemann@php.net> wrote:
Dan Herman wrote: I am sending a custom query to a DB_DataObject and then binding the dataobject to the datagrid. My problem is that when my query has arithmetic in it the columns do not display. An example query might be something like: SELECT products.partNumber,sum(orderitems.qty),products.cost,(products.cost*sum(orderitems.qty)) FROM orderitems,products WHERE orderitems.litunum = products.sku GROUP BY products.partNumber; Not sure, what DB_DO does with this query, but maybe adding 'AS xyz' after the calculations will help. For example, you could write "sum(orderitems.qty) AS sum" and "(products.cost*sum(orderitems.qty))" AS mult" in your query. 'sum' and 'mult' would then be your field names.I am certain that this is exactly what needs to be done. DB_DO uses the column name as the field to store the data in, as you should know. "cost * qty" is hardly a normal field name. I suggest using AS as well. -- Justin Patrin