[development] views: translate alias to real field

Lluís enboig at gmail.com
Thu Sep 24 15:08:18 UTC 2009


I am developing a module to allow operations between fields; it is
similar to views_calc but I use another approach to solve problems
with "agregated" fields.
So right now I use group by and I get:

SELECT a AS a1, SUM(b) AS b1, SUM(c) AS c1 FROM {table} GROUP BY a

I want to get

SELECT a AS a1, SUM(b) AS b1, SUM(c) AS c1, (SUM(b) - SUM(c)) AS minus
FROM {table} GROUP BY a

right now my module just get:
SELECT a AS a1, SUM(b) AS b1, SUM(c) AS c1, (b1 - c1) AS minus FROM
{table} GROUP BY a

any hint of how to get "original field" from alias?

-- 
*La vida és com una taronja, què esperes a exprimir-la?
*Si creus que l'educació és cara, prova la ignorància.
*La vida és com una moneda, la pots gastar en el que vulguis però
només una vegada.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.


More information about the development mailing list