Answer the question
In order to leave comments, you need to log in
How to get data from a table?
Good afternoon, tell me how can I write a sql query and get data from table A using data from table B?
There are 2 tables in postgresQL of this type:
Table A
await app.ds.pg.query(`SELECT location, id FROM A WHERE id IN (${list.sensorid.join(",")}) GROUP BY location, id`);
Answer the question
In order to leave comments, you need to log in
1. do you have apostrophes (or what is it?) instead of quotation marks?
2. the handler does not see the variable, it sees a line like
SELECT location, id FROM A WHERE id IN (${list.sensorid.join(",")}) GROUP BY location, id
await app.ds.pg.query('SELECT location, id FROM A WHERE id IN (' + ${list.sensorid.join(',')} + ') GROUP BY location, id');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question