Rép. : Subselects to populate a table

Поиск
Список
Период
Сортировка
От Erwan DUROSELLE
Тема Rép. : Subselects to populate a table
Дата
Msg-id 86eb6f9efc3c5aa20e0b7797b7e82d643e159825@
обсуждение исходный текст
Список pgsql-novice
Have you tried :

INSERT INTO "cards_type_temp"
( "card_game", "card_name", "card_table", "record_num" )
SELECT  'Vtes', "card_name", "card_type", "record_num" FROM
"cards_type" ;

(not tested however)

Erwan


>>> "Chris Boget" <chris@wild.net> 01/03 2:25  >>>
I've read through the docs and I couldn't find many examples of using
subselects.  I could find out and read all about what they were, but
not
many examples.  If someone could point to a page that does show this,
I'd be ever so appreciative!
Anyways, I'm redoing a table I imported from MySQL (as part of my
conversion to PG from MySQL) and I'm having problems with this.  The
error I'm getting is that it says you can't select more than one
column.
Why?  Is there another way to do what I'm trying?  Here is my query:

INSERT INTO "cards_type_temp"
( "card_game", "card_name", "card_table", "record_num" )
VALUES
( 'Vtes', ( SELECT "card_name", "card_type", "record_num" FROM
"cards_type" ));

Any help or insight would be great!

Chris


---------------------------(end of
broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org

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

Предыдущее
От: "Chris Boget"
Дата:
Сообщение: Subselects to populate a table
Следующее
От: "Ville Jungman"
Дата:
Сообщение: Re: How to determine the type of a column