Rapport de consommation: ajouter les immo au réel
[auf_coda_additions.git] / db / vues / auf_v_ControleBoursierBanques.sql
1 USE [coda-prod]
2 GO
3
4 SET ANSI_NULLS ON
5 GO
6 SET QUOTED_IDENTIFIER ON
7 GO
8 ALTER VIEW [dbo].[auf_v_ControleBoursierBanques]
9 AS
10 SELECT TOP 100 PERCENT E.code, B.nb_comptes
11 FROM dbo.oas_element E LEFT OUTER JOIN
12 (SELECT elmcode, COUNT(*) AS nb_comptes
13 FROM oas_elmbanklist
14 WHERE elmcode LIKE '%L'
15 GROUP BY elmcode) B ON E.code = B.elmcode
16 WHERE (E.elmlevel = 2) AND (E.deldate IS NULL) AND (E.endyear LIKE 0) AND (E.code LIKE '%L')
17 ORDER BY B.nb_comptes DESC
18 GO