Re: Inserting data of two other tables [Now deleting ...]

papapep <papapep@gmx.net>

From: papapep <papapep@gmx.net>
To: pgsql-novice <pgsql-novice@postgresql.org>
Date: 2003-05-28T16:59:08Z
Lists: pgsql-novice
Well, at last I've been able (with some help ;-D) to do it.

The query has been:

SELECT tarneto FROM detalltrajectes d WHERE d.journey = (SELECT c.pkey 
FROM CAPTRAJECTES WHERE c.pkey = d.journey AND fecha = 20030423);

With this one I've been able to "see" what was I going to remove, and 
with this one:

DELETE FROM DETALLTRAJECTES WHERE journey = (SELECT pkey FROM 
CAPTRAJECTES WHERE pkey = journey AND fecha = 20030423);

I have removed the rows. I have to mention that I first tried to "clone" 
the query, changing SELECT tarneto for DELETE obviously, but it didn't 
work. The parser said:

	ERROR:  parser: parse error at or near "d"

So what I did was to remove all the alias and it worked.... is it normal??

Thanks to all for your help, and specially to Nabil.

Josep Sànchez
   [papapep]