SQLite Forum

Help needed to return the right math results in sql query
Login
Hi,

In a query, I want SQLite to get records for three results, and on the fourth, I want to plug in a number manually and have SQLite calculate the results.


```
select
	count(IDRecord) as Counts,
	sum(xz) as xz_in,
	sum(zy) as zy_out,
	sum((zy_out)+82793601)/sum(xz_in)
from
	EGRRecord
```

Counts: 7574623

xz_in: 1893655750

zy_out: 1709334200

SQLite returns results 331175 for the result on the fourth field. Why? What does it think I'm asking for?

Is it possible to use the alias', like I am above? When I do so, SQLite says no column.