From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Shadkam Islam <shadkam(at)wipinfo(dot)soft(dot)net> |
Cc: | postgresSQL <pgsql-general(at)postgreSQL(dot)org> |
Subject: | Re: [GENERAL] Confusion in Insert Query syntax |
Date: | 1999-10-06 04:52:26 |
Message-ID: | 199910060452.AAA20045@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Gene Selkov, Jr. | 1999-10-06 05:33:20 | Yet another btree gotcha |
Previous Message | Shadkam Islam | 1999-10-06 04:34:24 | Confusion in Insert Query syntax |