On 12/18/06,
Carlos Santos <
carloscompels@yahoo.com.br> wrote:
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?
Can you provide the 2 queries you used to successfully do this in two database calls?
I am not sure that select makes sense. Where clauses work on rows, not columns. Having your two working queries will help us see what you are really trying to do.
--
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com http://codeelixir.com==================================================================