From: | Daniel Henrique Alves Lima <email_daniel_h(at)yahoo(dot)com(dot)br> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Simple SQL question |
Date: | 2004-03-09 04:21:59 |
Message-ID: | 404D4667.10206@yahoo.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Thank you, Jeremy.
I've built a function that returns a string from (cd_teacher, cd_course)
and i've create a functional index over this function, like :
create index teacher_course_idx on teacher_course
(build_unique_2p(cd_teacher,cd_course));
select * from teacher_course where build_unique_2p(cd_teacher,cd_course)
in ('1:2','23:11','563','341');
Is it possible to use "array cast" over cd_teacher and cd_course (just
an idea, i don't known the sintaxe), like:
select * from teachar_course where cast((cd_teacher,cd_course) as array)
in ('{1,2}','{23,11}','{563,341}');
?
I'm using postgreSQL 7.34
Thanks !!!
Jeremy Semeiks wrote:
>You could use a subselect of unions:
>
>select * from teacher_course where (cd_course, cd_teacher) in
>(select 1, 2 union select 23, 11 union select 563, 341)
>
>Maybe there's a more concise way, though.
>
>- Jeremy
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | David Witham | 2004-03-09 04:22:51 | ANALYZE error |
Previous Message | Christopher Browne | 2004-03-09 03:20:03 | Re: Trying to make efficient "all vendors who can provide all items" |