On 9 Feb 2006, at 12:50, Srinivas Iyyer wrote:
> Hi,
> thank you for correcting me. I agree, I am very weak
> in connecting tables, I did not digest the connecting
> logic, although based on my progra. experience i am
> able to write plpgsql functions etc not relating to
> sql query part.
> I am trying to learn from Bruce momjian's book.
>
> I have one more question, hope that is not problem for
> you to help me out again.
>
> How do I put another conditional that gos.go_cat = 'F'
> only.
>
> In the corrected query, I am getting all gos.go_term
> but I want only if gos.go_cat is 'F'.
>
>
> My version:
>
> select seq_name , go_term,go_cat from sequence, gos,
> go_seq where
> sequence.seq_name = 'EI24' AND
> gos.go_cat = 'F'AND
> sequence.seq_id = go_seq.seq_id AND
> go_seq.gos_id = gos.go_id AND
> gos.gos_id = gos.go_cat;
>
remove that last line "gos.gos_id = gos.go_cat". you've already done
the appropriate selection with "gos.go_cat = 'F'".
as you have it written now, i would suspect you are getting zero
results, because it's doubtful that the gos_id will ever equal the
go_cat.