brisonela
brisonela

Reputation: 125

4 TABLES INNER JOIN SQL STATEMENT

I have this database structure...

database

(It´s on spanish, hope doesn´t matter) and I made this query using inner join but I don´t get any result so I guess I did something wrong... This is my query...

SELECT TBoleta.NroSerie+'-'+TBoleta.NroBoleta Boleta, TBoleta.Fecha, 
TAlumno.APaterno+' '+TAlumno.AMaterno+' '+TAlumno.Nombres as Apellidos_y_Nombres, 
TGrupoModulo.Modulo + ' ' + TGrupoModulo.Seccion + ' ' + TGrupoModulo.Turno,
 TBoleta.Monto  

FROM        TMatricula 
        inner join TAlumno on TMatricula.CodAlumno = TAlumno.CodAlumno
        inner join TBoleta on TBoleta.NroMatricula = TMatricula.NroMatricula
        inner join TGrupoModulo on TGrupoModulo.CodGrupoModulo =    TMatricula.CodGrupoModulo

Please... I will appreciate any help. Thanks!

Upvotes: 2

Views: 13091

Answers (3)

Rafee
Rafee

Reputation: 4078

If any field column is empty, then result is not displayed. further if you want to display with empty or null values you can use LEFT JOIN in your query

Upvotes: 0

k_b
k_b

Reputation: 2480

For starters, this attribute doesn't exist; TBoleta.CodAlumno

Edit: Now that your query appears to be compiling fine, remember that inner joins necessitate data from each join to have matching values. If one of the joins don't, you get no data back. Analyze your data to figure this out. You could also do left outer joins at first, then move to inner joins step by step.

Upvotes: 3

user470714
user470714

Reputation: 2888

This is just a cursory guess, but this line:

inner join TAlumno on TBoleta.CodAlumno = TAlumno.CodAlumno

appears to be incorrect, because TBoleta doesn't have a column named CodAlumno. You should check to see if you're getting any errors whilst running this query.

Upvotes: 2

Related Questions