Re: select based on multi-column primary keys

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: select based on multi-column primary keys
Дата
Msg-id 20070120014524.GC30390@wolff.to
обсуждение исходный текст
Ответ на select based on multi-column primary keys  (mawrya <mawrya@furthernorth.net>)
Ответы Re: select based on multi-column primary keys
Список pgsql-sql
On Fri, Jan 19, 2007 at 16:44:50 -0800, mawrya <mawrya@furthernorth.net> wrote:
> I have set up a table with a multi-column primary key constraint:
> 
> If I had a row in the table where systemid=123, enclosureid=ab, 
> pointid=56, I would have a Primary Key ("ID") of 123ab56 for that row.
> 
> I now want to run a select based on the Primary Key, something like:
> 
> SELECT * FROM iopoints WHERE ID = 123ab56
> 
> Is something like this even possible?  Or am I forced to do:
> 
> SELECT * FROM iopoints WHERE systemid=123 AND enclosureid=ab AND pointid=56

SELECT * FROM iopoints WHERE systemid=123 AND enclosureid='ab' AND pointid=56

While in theory you could concatenate the columns and test that against a
particular value, you probably don't want to do that. (If you do, use a
functional index.)


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

Предыдущее
От: mawrya
Дата:
Сообщение: select based on multi-column primary keys
Следующее
От: "codeWarrior"
Дата:
Сообщение: Re: select based on multi-column primary keys