Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8833677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:50:15+00:00 2026-06-14T08:50:15+00:00

Postgres 8.4 DELETE FROM processing_transaction AS pt INNER JOIN processing_transaction_movement AS ptm ON pt.processing_transaction_id

  • 0

Postgres 8.4

DELETE
FROM processing_transaction AS pt 
INNER JOIN processing_transaction_movement AS ptm 
ON pt.processing_transaction_id = ptm.processing_transaction_id
LEFT OUTER JOIN test_package tesp ON pt.test_package_id = tesp.test_package_id
LEFT OUTER JOIN test_batch tbat On tesp.test_batch_id = tbat.test_batch_id
WHERE pt.processing_transaction_type = 'TEST';

I get following error:

ERROR: syntax error at >>INNER<<
LINE 1: DELETE FROM processing_transaction AS pt INNER JOIN processi…

Please could you help me to find the error in my SQL-query


Thank you for your support @desislavkamenov @jan.
Now I used this:

BEGIN WORK;

DELETE
FROM processing_transaction AS pt
USING processing_transaction_movement AS ptm, test_package tesp, test_batch tbat
WHERE pt.processing_transaction_type = ‘TEST’;
AND pt.processing_transaction_id = ptm.processing_transaction_id
AND pt.test_package_id = tesp.test_package_id
AND tesp.test_batch_id = tbat.test_batch_id

ROLLBACK;

But I need to delete data from two tables (processing_transaction and processing_transaction_movement) , I have looking for somethink like that and found out that I can do it with "ON DELETE CASCADE". But I don´t know how to use this here.
So Please help me again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:50:17+00:00Added an answer on June 14, 2026 at 8:50 am

    You can’t use JOIN in DELETE statement. Instead use USING and put the second table there.
    Something like this should work (sorry but i can’t test it, so run it after BEGINing a transaction and check the results if they are what you expect before COMMITting it; ROLLBACK if they aren’t).

    DELETE
    FROM processing_transaction AS pt 
    USING processing_transaction_movement AS ptm, test_package tesp, test_batch tbat 
    WHERE pt.processing_transaction_type = 'TEST'
    AND pt.processing_transaction_id = ptm.processing_transaction_id
    AND pt.test_package_id = tesp.test_package_id
    AND tesp.test_batch_id = tbat.test_batch_id
    

    Here is a link to the documentation.
    http://www.postgresql.org/docs/current/static/sql-delete.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm moving from MySql to Postgres, and I noticed that when you delete rows
Question. In this return from postgres EXPLAIN DELETE FROM ... : Delete (cost=0.00..19474.19 rows=266518
My Postgres query calculates statistical aggregate from a bunch of sensor readings: SELECT to_char(ipstimestamp,
I'm searching for a simple way to delete all data from a database and
For compliance reasons, when I delete a user's personal information from the database in
I'm manually constructing a DELETE CASCADE statement for postgres. I have a 'transaction' and
Is it possible either to delete all rows from all tables with a single
I am using postgres. I want to delete Duplicate rows. The condition is that
Postgres 9.0.4 Rails 3.0.7 AR 3.0.7 pg 0.12.2 I have a table with 3
postgres 9.2 supports json columns. what would be best way to extend postgres to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.