Hi all,
I have 2 tables:
Stats_table & output_table
In stats table there are 10k records, with a unique ID (inst_ID).
In output table there will be several thousand records of customers, and each customer also has an inst_ID assigned.
What I need to do is for every unique inst_ID in the...
Hi there,
I need a way to sum all selected <option> values from within a form. My form could have up to 100 <selects> all with a name of "Frequencynnnn" nnnn being an ID number.
I have tried to modify this script I found:
function getFields() { var inputs =...
Thank you - it says Row_Number is not a recognised function name....
Honestly you have been incredibly helpful, please dont feel you have to continue looking at this as you have given me so much to work from already
OK I will try and do that. I am not an expert in this area, so this is probably the most complex query I have been asked to do - all your help has been much appreciated.
Only thing I dont think its doing is when working out the average it should not take the latest month, so if I have Jan,Feb,Mar,April then 3 month avg should be jan,feb,mar/3 so that I can compare this average with the latest month
I have this as posted by you yesterday, which works great thanks - I just need to try and add these additional bits on as mentionned above
SELECT Prod_Code, Brick_Code, AVG(cast('0' + Number AS Int)) SalesAvg
FROM dbo.RAW_SALES_RSA31307
WHERE
cast(RIGHT(Month_Code, 2) + '/01/' +...
Any further suggestions guys?
I forgot to say in the post above, that yes indeed there was bad data in the date column!
I really need to try and end up with this view:
Product - Brick_code - 3MonthAvg - 6MonthAvg - LatestMonth
Thanks :)
Hey guys - we are getting there!
I changed to AVG(CAST(NUMBER AS Int)) since this is not money values we are talking about, its quantity.
Can I just check - is it taking the last 3 months, but not including the latest month, to calculate the average?
Could I also add in a 6 month average, but...
I am having all sorts of errors! I have pasted the query below - could you check the syntax for me:
SELECT Prod_Code, Brick_Code, AVG(cast('0' + Number AS Money)) SalesAvg
FROM dbo.RAW_SALES_RSA31307
WHERE cast(RIGHT([Month_Code], 2) + '/01/' + LEFT([Month_Code], 4) AS datetime...
I get "syntax error converting datetime from character string"
Also the sales is a sales quantity rather than money value, so I guess I still want numeric?
This looks good. However all columns are varchar data type - can I convert the month to datetime and sales to numeric at the same time?
Appreciate your help
Hi - thanks for the reply
What I mean is there will be 12 months data - a row for each month and each product and each postcode. So if there 12 rows, each a different month, I need to take the last 3 months/rows but dont include the latest month
What I am actually doing here is I will take...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.