create sql with 2 table

hey guy I’m new with python
how I create filter to return query with relationship with another table

like: return name and lastName if table_id = 1

A good place to start is with the appropriate documentation, in this case, the query documentation on Retrieving objects, the Lookup API Reference, and the Related Objects Reference.

If you’re not comfortable with these topics, then I’d recommend going back to basics and working your way through either or both of the official Django Tutorial, and the Django Girls Tutorial.