|
I have a table that has id, usage, date(decimal date) this is a daily file.
I am summing the usage by id and grouping by id, year and month.
I have a udf that I apply to the date to convert it to a true date getdatesql(mydate)
So I might have
ID useage year month
1 10 2019 1
1 15 2019 2
2 5 2020 1
2 30 2020 2
SELECT id, sum(metereduse), year(getdatesql(readdate)),
month(getdatesql(readdate)) FROM dailyuse
GROUP BY id, year(getdatesql(readdate)), month(getdatesql(readdate))
ORDER BY id, year(getdatesql(readdate)), month(getdatesql(readdate))
I am not sure if I can or how I might do this, but
I would like to add a having clause that
Would identify the id, and usage that has say a 50% change between a given period. Could be a last month, this month,
Or last year, month vs this year, month
NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.