开发者

4 TABLES INNER JOIN SQL STATEMENT

开发者 https://www.devze.com 2023-03-13 12:38 出处:网络
I have this database structure... (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...

I have this database structure...

4 TABLES INNER JOIN SQL STATEMENT

(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.APatern开发者_如何转开发o+' '+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!


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消