Tengo el siguiente código PostgreSQL
:
SELECT(v1.contrato, v1.status, v1.sucursal, p1.numero_pedido,
p1.contrato, p1.status, p2.nombre, p2.apellido_pat, p2.apellido_mat, p2.telefono_dire)
FROM vales as v1
INNER JOIN pedidos as p1
On v1.contrato=p1.contrato
INNER JOIN personas as p2
on v1.contrato=p2.contrato
INNER JOIN contratos as c1
on v1.contrato=c1.contrato
WHERE v1.sucursal IN (12,22,49,58)
el resultado debería ser una tabla, sin embargo me arroja un único registo:
"(""1002 "",1,12,184,""1002 "",""1 "",Omar,Chávez,Hernández,5655124545)"
"(""1003 "",1,22,785,""1003 "",""1 "",Ruben,Luján,García,5709385319)"
"(""1004 "",1,49,654,""1004 "",""1 "",Fernanda,Darío,López,5760724862)"
"(""1005 "",0,58,156,""1005 "",""0 "",Lucia,Montés,Hernández,5833087616)"
"(""1006 "",1,58,185,""1006 "",""1 "",María,Fuentes,Flores,5902914550)"
"(""1007 "",1,22,488,""1007 "",""1 "",Edna,López,Garces,5955452979)"
"(""1011 "",0,49,485,""1011 "",""0 "",Luisa,Pérez,""de la O"",6246720900)"
¿Qué puedo estar haciendo mal?