<?xml version="1.0" encoding="iso-8859-1"?>
<turisoftreportfile title="Informe completo de explotabilidad agrupada por agrupación y vivienda" breakpoint="0,1,5" group="">
	<parameters>
	</parameters>
	<sql>SELECT
	AGRUPACIONES."Descripción" AS AGRUPACIONES."Agrupación" ,
	EXPLOT1."Vivienda",
	EXPLOT1."Fecha" AS EXPLOT1."Desde",
	MIN(EXPLOT2."Fecha") AS EXPLOT2."Hasta",
	MIN(EXPLOT2."Fecha")-EXPLOT1.Fecha AS EXPLOT1."Noches$SUM",
	PROPIET."Nombre" Propietario
FROM
	RESERVABLE AS EXPLOT1,RESERVABLE AS EXPLOT2,AGRUPACIONES,
	VIVIENDAS,PROPIET
WHERE
	EXPLOT1."Agrupación"=EXPLOT2."Agrupación"
	AND EXPLOT1."Vivienda"=EXPLOT2."Vivienda"
	AND EXPLOT1."Inicio"="S"
	AND EXPLOT2."Inicio"="N"

	AND EXPLOT1."Fecha"&lt;=EXPLOT2."Fecha"
	AND AGRUPACIONES."Código"=RESERVABLE."Agrupación"
	AND VIVIENDAS."Agrupación"=EXPLOT1."Agrupación"
	AND VIVIENDAS."Vivienda"=EXPLOT1."Vivienda"
	AND PROPIET."Código"=VIVIENDAS."Propietario"
GROUP BY
	EXPLOT1."Agrupación",
	EXPLOT1."Vivienda",
	EXPLOT1."Inicio",
	EXPLOT2."Inicio",
	EXPLOT2."Vivienda",
	EXPLOT1."Fecha",
	AGRUPACIONES."Descripción",
	PROPIET."Nombre"


ORDER BY
	AGRUPACIONES."Descripción",
	EXPLOT1."Vivienda",
	EXPLOT1."Fecha"</sql>
	<totals>
	</totals>
	<footer></footer>
</turisoftreportfile>
