| От | webcoyote |
|---|---|
| Тема | SELECT with column specified by subquery |
| Дата | |
| Msg-id | 1399317326878-5802533.post@n5.nabble.com обсуждение исходный текст |
| Ответы |
Re: SELECT with column specified by subquery
|
| Список | pgsql-general |
I desire to create a SELECT statement where one of the column names comes from another table. Something like: SELECT id, (SELECT type FROM favorite_food_type WHERE user = 'ralph') FROM foods; If Ralph's favorite food type is fruit, ultimately I'd like the query to become: SELECT id, fruit FROM foods; Instead I get: SELECT id, 'fruit' FROM foods; Where 'fruit' is a string and not treated as a column name. Is there any way to do this? Thank you! -- View this message in context: http://postgresql.1045698.n5.nabble.com/SELECT-with-column-specified-by-subquery-tp5802533.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера