SQLite Forum

Help needed to return the right math results in sql query
Login
You must phrase the query thusly because aliases only apply to name the projection output and do not have scope within the select clause.

```
select Counts,
       xz_in,
       zy_out,
       (zy_out + 82793601.0) / xz_in
  from (
         select count(IDRecord) as Counts,
                sum(xz) as xz_in,
                sum(zy) as zy_out
           from EGRecord
       )
;
```

Note the number added is floating point because I assume that you wish a floating point answer, not an integer answer.