开发者

4 TABLES INNER JOIN SQL STATEMENT

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜