Search code examples
databaseinfluxdbinfluxql

How I get specific row during query from two tables in Influx


I tried to write a query to Influx Database in below example:

I have two tables:

table_1

id | value 
1  | 100
2  | 200

table_2

id | value 
1  | 900
2  | 800

I want to use one query to gets rows: id 1 and 2 from table_1 and id 2 from table_2

In query: SELECT * FROM table_1, table_2 WHERE id=1 AND id=2... I getting all data.

I tried: SELECT * FROM table_1, table_2 WHERE table_1.id=1 AND id=2 ... but it doesn't work.

Thanks for help!


Solution

  • I used sub-queries eg.

    SELECT * FROM (SELECT * FROM table_1 WHERE id='1' AND id='2'), (SELECT * FROM table_2 WHERE id='2') WHERE ...