-1
Hello, I have a code in nodejs with mysql database. on one of the paths referring to the path(path) need to fetch all readings from 3 sensors (each sensor is a table) that have the path field equal to the path id, I used a model of chained predecessors but ended up changing to a model with await like the one below
path.gps = await sql_op.select(null, targets, 'gps')
path.giroscopio = await sql_op.select(null, targets, 'giroscopio')
path.acelerometro = await sql_op.select(null, targets, 'acelerometro')
the search functions in mysql are implemented and work correctly, each of them returns a promisse that solves when the search is completed, my doubt is on how to optimize this query, since I have to make the 3 selects to can display the data on the page
Good afternoon, one way to optimize is to create only a select since you share the path field.
– Chance