Re: EXISTS syntax for SELECT INTO?
| From: | Chris | Date: | Thu, 12 Oct 2006 00:16:51 +0000 |
| Subject: | Re: EXISTS syntax for SELECT INTO? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42532@lists.php.net to get a copy of this message | ||
Tony Grimes wrote:
I have a script that creates a table copy using SELECT INTO, but I want it to check if the new table already exists first. Does SQL support the EXISTS keyword for SELECT INTO statements (I'm running PG7)? If not, is there another way to do it in SQL? I'd rather not do it programmatically.You could probably do it with a subquery: select into table1 from table2 where not in (select id from table1); Hopefully that gets you started :) -- Postgresql & php tutorials http://www.designmagick.com/