Query gives me repeated data

0

Good: When I make this query, it gives me the repeated data that I have in the table (and2018payments). Is there any way to show me the data once?

$qry = "select alu.id_alumno, matr.curso, matr.fecha,  matr.grado , alu.proceinsti, alu.apellidos, alu.nombres, alu.docutip, alu.genero, alu.docunum, alu.docuexp, alu.genero, alu.lugnace, alu.depnace, alu.paisnace, 
alu.fchnace, alu.correo, alu.celular, fam.apellidos AS  'apellidos_fam', fam.nombres AS  'nombres_fam', 
fam.tipo, fam.direccion, fam.telefono, fam.barrio, fam.docunum AS 'numero_fam'
FROM alumnos alu
INNER JOIN matriculas matr ON matr.id_alumno = alu.id_alumno
INNER JOIN familiares fam ON fam.id_familiar = alu.id_familiar
INNER JOIN y2018pagos pag ON pag.id_alumno = alu.id_alumno
WHERE matr.ano = '".$año."' AND matr.estado = 'CERRADA' AND pag.valor != '0'";

$res = mysql_query($qry);    
    
asked by AUDYMA 10.01.2018 в 15:22
source

1 answer

0

Right after the "SELECT" use DISTINCT and enclose everything you want to be different in parentheses:

  

SELECT DISTINCT (COLUMN1) FROM ...

This works with PL / SQL . I'm not sure if in others too

    
answered by 10.01.2018 / 17:45
source