1nstan7 Posted January 4, 2015 Share Posted January 4, 2015 (edited) http://www.w3schools.com/sql/sql_func_avg.asp The example they show is SELECT AVG(Price) AS PriceAverage FROM Products; They did AVG(price) which gets the price but then they have "PriceAverage". Is that a new varible? My example table called "purchase": Car price purchase Date smcar £10 01/12/2014 smfar £20 03/12/2014 In my case will this be "SELECT AVG(price) as PriceAverage FROM purchase" ? If so how would I do this and show only purchases after 02/12/2014? Edited January 4, 2015 by 1nstan7 Link to comment Share on other sites More sharing options...
davej Posted January 4, 2015 Share Posted January 4, 2015 If your column name for the date is purchasedate then try... SELECT AVG(price) AS MyLABELFROM purchaseWHERE purchasedate >= '2014-02-13' Link to comment Share on other sites More sharing options...
1nstan7 Posted January 13, 2015 Author Share Posted January 13, 2015 If your column name for the date is purchasedate then try... SELECT AVG(price) AS MyLABELFROM purchaseWHERE purchasedate >= '2014-02-13' Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now