Author: danydb Date: 2012-01-07 05:59:00 +0100 (Sat, 07 Jan 2012) New Revision: 265
Added: trunk/coprop/sql/create_view_summary.sql.sql Log: create view Added: trunk/coprop/sql/create_view_summary.sql.sql =================================================================== --- trunk/coprop/sql/create_view_summary.sql.sql (rev 0) +++ trunk/coprop/sql/create_view_summary.sql.sql 2012-01-07 04:59:00 UTC (rev 265) @@ -0,0 +1,14 @@ +create view coprop.summary as select a.f_id, +(select ad_value from fiche_detail as fd1 where fd1.f_id=a.f_id and fd1.ad_id=1) as lot_name, +(select ad_value from fiche_detail as fd1 where fd1.f_id=a.f_id and fd1.ad_id=23) as lot_qcode, +m.ad_value as building_id, +(select ad_value from fiche_detail as fd1 where fd1.f_id=m.ad_value::numeric and fd1.ad_id=1) as immeuble, +c.ad_value as coprop_id, +(select ad_value from fiche_detail as fd1 where fd1.f_id=c.ad_value::numeric and fd1.ad_id=1) as coprop + + from fiche_detail as a + join fiche as f1 on (f1.f_id=a.f_id) + join (select f_id,ad_value from fiche_detail as fd1 where ad_id=9003) as m on (m.f_id=a.f_id) +join (select f_id,ad_value from fiche_detail as fd1 where ad_id=9002) as c on (c.f_id=a.f_id) + + where fd_id=8 and ad_id=1; _______________________________________________ Phpcompta-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/phpcompta-dev
