HI all,
I 've just started using cakephp mostly to learn hot to work with web apps. I’m following the cms tutorial but I use an existing postgres db with a couple of tables and so far I managed to do what I wanted to do but this is out of my league probably. I have a query I use in pgadmin to fetch some data from a (single) table which calculates additional fields from the existing ones and it goes likes that :
SELECT after,
DiffMTNSVEF,
to_char (inprcntBVEF, ‘MI0.000’),
inmtsBVEF,
to_char (inprcntSBLBVEF, ‘MI0.000’),
DiffMTNAVEF,
to_char (inprcntAVEF, ‘MI0.000’),
DiffMTNAVEF,
to_char (inprcntSBLAVEF, ‘MI0.000’)
FROM co_figures,
LATERAL
(SELECT own/vef AS after) after,
LATERAL
(SELECT own - vsl AS inmtsSvslBVEF) DiffMTNSVEF,
LATERAL
(SELECT inmtsSvslBVEF *100/own AS inprcntBVEF) InPercentSvslBVEF,
LATERAL
(SELECT own - bl AS inmtsBVEF) DiffInMetricTonsSBLBVEF,
LATERAL
(SELECT inmtsBVEF *100/bl AS inprcntSBLBVEF) InPercentSBLBVEF,
LATERAL
(SELECT after - vsl AS inmtsSvslAVEF) DiffMTNAVEF,
LATERAL
(SELECT inmtsSvslAVEF *100/after AS inprcntAVEF) InPercentSvslAVEF,
LATERAL
(SELECT after - bl AS inmtsSBLAVEF) DiffMTNAVEF,
LATERAL00
(SELECT inmtsSBLAVEF *100/after AS inprcntSBLAVEF) InpercentSBLAVEF
WHERE co_figures.no = ‘14’
Can I do such a query in my Entity model ? are there other ways to calculate results in a single record view from the table record ? I would be happy to receive any pointers to read on
thanks in advance
George