how to build a query so that id user_id = 19 page value from tmp table where user_id = 19

 ... c.execute('SELECT * FROM Сontent WHERE id = # ? ') 

    2 answers 2

    If I understand correctly, there are 2 tables:

    1. my_table with id fields, ...
    2. tmp with page , user_id , ... fields

    Then the query is:

     SELECT * FROM my_table join tmp on my_table.id = tmp.page WHERE tmp.user_id = 19 

      For example:

       select * from tmp, Content where Content.id=tmp.page and user_id=19;