I'm very new to writing queries in general for PostgreSQL, much less Knex, so I appreciate any help somebody can provide.
PostgreSQL v10.12
Knex v0.20.13
Node v12.16.0
Say I have a DB with entries such as:
id | int1 | int2
_____________________
1 5 10
2 6 15
And my knex query looks something like this:
db // This is my knex connection
.from('items AS item')
.select(
'item.id',
'item.int1',
'item.int2'
)
How would I go about adding a column to my results that would SUM int1 and int2?
id | int1 | int2 | sum
_______________________________
1 5 10 15
2 6 15 21