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 @ 46402
History | View | Annotate | Download (3.95 KB)
1 |
|
---|---|
2 |
-- testToDoubleWithSpecialFunctions SQL
|
3 |
|
4 |
-- Select
|
5 |
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 |
("PUBLIC"."ARENA2_ACCIDENTES"."KM" * 222) AS "AccKm2", |
38 |
"PUBLIC"."ARENA2_ACCIDENTES"."KM" |
39 |
FROM "PUBLIC"."ARENA2_CONDUCTORES" |
40 |
LEFT JOIN "PUBLIC"."ARENA2_ACCIDENTES" ON ( ("PUBLIC"."ARENA2_CONDUCTORES"."ID_ACCIDENTE") = ("PUBLIC"."ARENA2_ACCIDENTES"."ID_ACCIDENTE") ) |
41 |
ORDER BY "LID_CONDUCTOR" ASC LIMIT 15; |
42 |
|
43 |
-- Count
|
44 |
SELECT COUNT(*) FROM "PUBLIC"."ARENA2_CONDUCTORES"; |
45 |
|
46 |
-- Count with groupby
|
47 |
SELECT COUNT(*) FROM ( SELECT COUNT(*) FROM "PUBLIC"."ARENA2_CONDUCTORES" GROUP BY ((FOREING_VALUE('ID_ACCIDENTE.KM')) * 222)) as _subquery_alias_ ; |
48 |
|
49 |
-- Result with groupby
|
50 |
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_ ; |