Hi, im with a little problem here, trying to get data from 3 tables using postgreSQL
Table 1: Fenologia
Fields: idfeno
namefeno
Table 2: Especie
Fields: idespecie
nameespecie
Table 3: Especiexfeno (Its a nub between the otherones)
Fields: idespecie
idfeno
I need to obtain all "fenologias" from one "especie".
For example if the table 3 data is:
idespecie: 4 - 4 - 3 - 2
idfeno : 1 - 2 - 4 - 1
i need to obtain the 4-1 4-2 plus the name of the data obtained from the others tables
The query i have is:
select f.namefeno, x.idespecie, x.idfeno, e.nameespecie
from fenologia f, especiexfeno x, especie e
where x.idespecie in (select x.idespecie from especiexfeno x
where x.idespecie = '4');
and
select f.nomfeno, x.codespecie, x.codfeno, e.nomespecie
from fenologia f, especiexfeno x, especie e
where x.codespecie = '4';
for example if 4 in the table "especie" is Orange and in the table "fenologia" 1 is big and 2 is small i need to obtain:
Big Orange 1 4
Small Orange 2 4
dont know how to do this, and the query im using returns me like 9 columns, that doesnt even exists.... (both query returns the same result)
hope you can help me with this one..
thanks