SELECT with WHERE clause by column number

Поиск
Список
Период
Сортировка
От Carlos Santos
Тема SELECT with WHERE clause by column number
Дата
Msg-id 20061218171739.98671.qmail@web57105.mail.re3.yahoo.com
обсуждение исходный текст
Ответы Re: SELECT with WHERE clause by column number  (Richard Huxton <dev@archonet.com>)
Re: SELECT with WHERE clause by column number  ("Aaron Bono" <postgresql@aranya.com>)
Re: SELECT with WHERE clause by column number  (Ragnar <gnari@hive.is>)
Список pgsql-sql
Hi!

I need to make a query like this:

SELECT id FROM myTable WHERE column-number = 'value';
(PS: The id column is the primary key of myTable).

That is a select using column number in the WHERE clause what don't exists in SQL.

I need this because there's a situation in my program where I don't have the column name.
I've solved that querying Postgresql the name of the column with that number, and then creating  the SELECT query.
But this solution is slow... two database calls...

Can I do this with a single query or in a faster way through SQL, an internal function or through a Procedural Language?

Thanks

Carlos Henrique Iazzetti Santos
Compels Informática
Santa Rita do Sapucaí - MG
BRAZIL
www.compels.net


Yahoo! Acesso Grátis - Internet rápida e grátis. Instale o discador agora!

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

Предыдущее
От: "Mark"
Дата:
Сообщение: Requirement for PostgreSQL Database Developer
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: SELECT with WHERE clause by column number