How do I complete SQL table name with a variable value?

Asked

Viewed 78 times

0

I want to create a new table for each client and I want to complete the account table with the client id I am creating in another table as in the example below:

await db.run('create table if not exists conta**ID** (saldo INTEGER);')

for each client created in the client table he gets an id automatically, I would like to take his id save in a variable to complete the name of this new table with the value of it, how do this?

1 answer

0

Usually just put the query return, which probably returns the entered data, inside a variable.

const user = await db.run('insert into users...')

Then it’s just ID pick up with user.id

Browser other questions tagged

You are not signed in. Login or sign up in order to post.