Consult 3 tables between dates with inner join

0

I consult 3 tables with range of dates, my small application is in development, in the main table or the first I have 4 records in the second I have 5 and in the third 7 records, but it turns out that it only extracts me from the tables 4 records of each table, when in the instruction in the range of the date I put the most recent final date to the record that is in my table this is my query

 Dim InfoIni As String = Format(DTPIni.Value, "MM/dd/yyyy")
 Dim InfoFin As String = Format(DTPFin.Value, "MM/dd/yyyy")
 Dim Totales As String = _
                "SELECT SUM (CUOTAS.CUOTA)AS CUOTA, SUM(CUOTAS.INASISTENCIA)AS INASISTENCIA, SUM(CUOTAS.MULTAS)AS MULTAS, SUM (CUOTAS.OTROS)AS NuevoSocio, " _
 & "SUM (PRESTAMOS.ABONO)AS ABONO, SUM (PRESTAMOS.CONDONO)AS CONDONO, SUM(PRESTAMOS.NUEVO)AS NuevoPrestamo, " _
    & "SUM(GASTOS.IMPORTE)AS ImporteGasto " _
    & "FROM (CUOTAS INNER JOIN PRESTAMOS ON PRESTAMOS.Id = CUOTAS.Id) " _
    & "INNER JOIN GASTOS ON GASTOS.Id = CUOTAS.Id WHERE CUOTAS.FECHA BETWEEN #" & InfoIni & "# AND #" & InfoFin & "#" 

Each table has a Id field, one of Fecha

How do I rescue all the records that are in the range?

My tables are in Access and VB.NET.

    
asked by J. Luis R.A. 03.08.2018 в 15:31
source

1 answer

0

The IDs may be different in the INNER JOIN, remember that in the INNER JOIN if any condition is not met, it will not return the record. You can use a LEFT JOIN instead and it might work for you. But without seeing the data I can not help you much.

    
answered by 03.08.2018 в 16:41