svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.h2spatial / org.gvsig.h2spatial.h2gis132 / org.gvsig.h2spatial.h2gis132.provider / src / test / resources / org / gvsig / fmap / dal / store / h2 / usecases / arena2 / testMultipleExpansionOfCalculatedField.sql @ 46505
History | View | Annotate | Download (3.95 KB)
1 | 46104 | omartinez | |
---|---|---|---|
2 | 46110 | omartinez | -- testToDoubleWithSpecialFunctions SQL
|
3 | 46104 | omartinez | |
4 | -- Select
|
||
5 | 46113 | omartinez | SELECT "PUBLIC"."ARENA2_CONDUCTORES"."LID_CONDUCTOR", "PUBLIC"."ARENA2_CONDUCTORES"."ID_ACCIDENTE", |
6 | "PUBLIC"."ARENA2_CONDUCTORES"."LID_VEHICULO", "PUBLIC"."ARENA2_CONDUCTORES"."ID_VEHICULO", |
||
7 | "PUBLIC"."ARENA2_CONDUCTORES"."POSIBLE_RESPONSABLE", "PUBLIC"."ARENA2_CONDUCTORES"."FECHA_NACIMIENTO", |
||
8 | "PUBLIC"."ARENA2_CONDUCTORES"."SEXO", "PUBLIC"."ARENA2_CONDUCTORES"."NACIONALIDAD", |
||
9 | "PUBLIC"."ARENA2_CONDUCTORES"."PAIS_RESIDENCIA", "PUBLIC"."ARENA2_CONDUCTORES"."PROVINCIA_RESIDENCIA", |
||
10 | "PUBLIC"."ARENA2_CONDUCTORES"."MUNICIPIO_RESIDENCIA", "PUBLIC"."ARENA2_CONDUCTORES"."ASISTENCIA_SANITARIA", |
||
11 | "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_FACT_ATENCION", "PUBLIC"."ARENA2_CONDUCTORES"."FACTORES_ATENCION", |
||
12 | "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_PRES_ERROR", "PUBLIC"."ARENA2_CONDUCTORES"."PRESUNTOS_ERRORES", |
||
13 | "PUBLIC"."ARENA2_CONDUCTORES"."CARACT_PERMISO", "PUBLIC"."ARENA2_CONDUCTORES"."CLASE_PERMISO", |
||
14 | "PUBLIC"."ARENA2_CONDUCTORES"."FECHA_PERMISO", "PUBLIC"."ARENA2_CONDUCTORES"."MOTIVO_DESPLAZAMIENTO", |
||
15 | "PUBLIC"."ARENA2_CONDUCTORES"."DESPLAZAMIENTO_PREVISTO", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_CINTURON", |
||
16 | "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_CASCO", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_BRAZOS", |
||
17 | "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_ESPALDA", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_TORSO", |
||
18 | "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_MANOS", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_PIERNAS", |
||
19 | "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_PIES", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_PRENDA_REF", |
||
20 | "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_ALCOHOL", "PUBLIC"."ARENA2_CONDUCTORES"."PRUEBA_ALCOHOLEMIA", |
||
21 | "PUBLIC"."ARENA2_CONDUCTORES"."TASA_ALCOHOLEMIA1", "PUBLIC"."ARENA2_CONDUCTORES"."TASA_ALCOHOLEMIA2", |
||
22 | "PUBLIC"."ARENA2_CONDUCTORES"."PRUEBA_ALC_SANGRE", "PUBLIC"."ARENA2_CONDUCTORES"."SIGNOS_INFLU_ALCOHOL", |
||
23 | "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_DROGAS", "PUBLIC"."ARENA2_CONDUCTORES"."PRUEBA_DROGAS", |
||
24 | "PUBLIC"."ARENA2_CONDUCTORES"."AMP", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_AMP", |
||
25 | "PUBLIC"."ARENA2_CONDUCTORES"."BDZ", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_BDZ", |
||
26 | "PUBLIC"."ARENA2_CONDUCTORES"."COC", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_COC", "PUBLIC"."ARENA2_CONDUCTORES"."THC", |
||
27 | "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_THC", "PUBLIC"."ARENA2_CONDUCTORES"."METH", |
||
28 | "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_METH", "PUBLIC"."ARENA2_CONDUCTORES"."OPI", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_OPI", |
||
29 | "PUBLIC"."ARENA2_CONDUCTORES"."OTRAS", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_OTRAS", |
||
30 | "PUBLIC"."ARENA2_CONDUCTORES"."SIGNOS_INFLU_DROGAS", "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_PRES_INFRAC_COND", |
||
31 | "PUBLIC"."ARENA2_CONDUCTORES"."PRES_INFRAC_COND", "PUBLIC"."ARENA2_CONDUCTORES"."PRES_INFRAC_SIN_LUCES", |
||
32 | "PUBLIC"."ARENA2_CONDUCTORES"."PRES_INFRAC_SIN_TRIANGULO", "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_PRES_INFRAC_VEL", |
||
33 | "PUBLIC"."ARENA2_CONDUCTORES"."PRES_INFRAC_VEL_COND", "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_OTRA_INFRAC", |
||
34 | "PUBLIC"."ARENA2_CONDUCTORES"."OTRA_INFRAC_COND", "PUBLIC"."ARENA2_CONDUCTORES"."EXTRA", |
||
35 | "PUBLIC"."ARENA2_ACCIDENTES"."KM" AS "AccKm0", |
||
36 | ("PUBLIC"."ARENA2_ACCIDENTES"."KM" * 100) AS "AccKm1", |
||
37 | 46505 | fdiaz | ("PUBLIC"."ARENA2_ACCIDENTES"."KM" * 222) AS "AccKm2" |
38 | 46113 | omartinez | FROM "PUBLIC"."ARENA2_CONDUCTORES" |
39 | LEFT JOIN "PUBLIC"."ARENA2_ACCIDENTES" ON ( ("PUBLIC"."ARENA2_CONDUCTORES"."ID_ACCIDENTE") = ("PUBLIC"."ARENA2_ACCIDENTES"."ID_ACCIDENTE") ) |
||
40 | 46505 | fdiaz | ORDER BY "PUBLIC"."ARENA2_CONDUCTORES"."LID_CONDUCTOR" ASC LIMIT 15; |
41 | 46104 | omartinez | |
42 | -- Count
|
||
43 | 46113 | omartinez | SELECT COUNT(*) FROM "PUBLIC"."ARENA2_CONDUCTORES"; |
44 | 46221 | omartinez | |
45 | -- Count with groupby
|
||
46 | SELECT COUNT(*) FROM ( SELECT COUNT(*) FROM "PUBLIC"."ARENA2_CONDUCTORES" GROUP BY ((FOREING_VALUE('ID_ACCIDENTE.KM')) * 222)) as _subquery_alias_ ; |
||
47 | |||
48 | -- Result with groupby
|
||
49 | SELECT COUNT(*) FROM ( SELECT COUNT(*) FROM "PUBLIC"."ARENA2_CONDUCTORES" LEFT JOIN "PUBLIC"."ARENA2_ACCIDENTES" ON ( ("PUBLIC"."ARENA2_CONDUCTORES"."ID_ACCIDENTE") = ("PUBLIC"."ARENA2_ACCIDENTES"."ID_ACCIDENTE") ) GROUP BY ("PUBLIC"."ARENA2_ACCIDENTES"."KM" * 222)) as _subquery_alias_ ; |