Use a join statement, something like this:
SELECT debts.nameID, debts.amount, (whatever the other
columns in debts you need are), names.name, names.surname FROM
debts JOIN names ON names.ID = debts.nameID
This will join the columns with the same numeric nameID from
each table you have to use the advanced dialog when making the sql
statement and be sure to define your variable as the proper type
that matches db column types( numeric, text, date ect)
Look at these:
http://www.w3schools.com/sql/sql_join.asp
http://msdn2.microsoft.com/en-us/library/bb208854.aspx