Re: SQL Query gone wrong.. please help

Поиск
Список
Период
Сортировка
От Murat Tasan
Тема Re: SQL Query gone wrong.. please help
Дата
Msg-id 4B448690-E20F-4B2B-85F8-D7E9B2C3A885@cwru.edu
обсуждение исходный текст
Ответ на Re: SQL Query gone wrong.. please help  (Srinivas Iyyer <srini_iyyer_bio@yahoo.com>)
Список pgsql-novice
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.




В списке pgsql-novice по дате отправления:

Предыдущее
От: Srinivas Iyyer
Дата:
Сообщение: Re: SQL Query gone wrong.. please help
Следующее
От: "Luiz K. Matsumura"
Дата:
Сообщение: Autovacuum log messages