dave
dave

Reputation: 1

Delete Rows based on Reference IDs

I am working on an AIR application that uses a local SQL lite DB to store information before it posts the data to a MySQL DB on the server at the end of each day. The data is posted in sets by user sessions. Once the data has posted i need to delete all rows associated with that session based on the session id. I have read many posts on this site and seen many ways to do this - unfortunately i have had little success getting them to run in SQL lite Manager - where i have been testing before i place it into the actionscript code. the following is one such attempt:

DELETE vendor_interest
  FROM vendor_interest v
INNER JOIN screen_view s on s.id = v.screen_view_id
                        and s.session_id = 44

The screen_view table has the reference to the session ID and to the vendor_interest table where i am trying to delete all the rows associated with the session.

Upvotes: 0

Views: 872

Answers (1)

Lamak
Lamak

Reputation: 70638

You can try something like this:

DELETE FROM vendor_interest 
WHERE screen_view_id IN (SELECT id FROM screen_view WHERE session_id = 44); 

Upvotes: 1

Related Questions