Re: [GENERAL] Confusion in Insert Query syntax
| От | Bruce Momjian |
|---|---|
| Тема | Re: [GENERAL] Confusion in Insert Query syntax |
| Дата | |
| Msg-id | 199910060452.AAA20045@candle.pha.pa.us обсуждение |
| Ответ на | Confusion in Insert Query syntax (Shadkam Islam <shadkam@wipinfo.soft.net>) |
| Список | pgsql-general |
> Hi All,
>
> If I type \h insert at psql it shows me,
>
> INSERT INTO class_name [(attr1, ...attrN)]
> VALUES (expr1,..exprN) |
> SELECT [DISTINCT [ON attrN]]
> expr1, ...exprN
> [FROM from_clause]
> [WHERE qual]
> [GROUP BY group_list]
> [HAVING having_clause]
> [ { UNION [ALL] | INTERSECT | EXCEPT } SELECT ...];
>
>
> But when I tried the following query it gave the parse error
>
>
> INSERT INTO EffortTable (EffortID)
> VALUES (ValueForEffortID) |
> SELECT MAX(EffortID) AS ValueForEffortID
> FROM EffortTable
> WHERE ProjectID=200;
>
The | means 'or' meaning INSERT INTO table VALUES or INSERT INTO
table SELECT.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
В списке pgsql-general по дате отправления: