'Best' way to create calculated field

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

'Best' way to create calculated field

Cecil Westerhof-5
At the moment I have the following query:
SELECT Minimum
,      Maximum
,      Maximum - Minimum AS Range
FROM   (
    SELECT MIN(totalUsed) AS Minimum
    ,      MAX(totalUsed) AS Maximum
    FROM   quotes
)

I like this better as:
SELECT MIN(totalUsed)                  AS Minimum
,      MAX(totalUsed)                  AS Maximum
,      MAX(totalUsed) - MIN(totalUsed) AS Range
FROM   quotes

​Or is there a reason to go for the second query, or even a total different
query?​

--
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users