日期差异计算 [英] date difference calculation

查看:151
本文介绍了日期差异计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道怎么开始这个。我使用访问03建立一个数据库来存储我的水区计量读数。到目前为止我有2张桌子,1张消费者信息和2个月度读数。我需要一个查询来调出每个消费者当前月份读数和上个月抄表之间的差异。这就是我陷入困境的原因,因为我从未使用过访问权来做任何事情。所以我想id问,我在这里。表1消费者信息除了名称和地址之外没有多少存储。如果需要,我可以稍后添加更多信息。表2是存储有用信息的地方。它有消费者姓名,日期和抄表。我想弄清楚的是如何获得月度计读数之间的差异,这样我就可以制作一份报告,打印出一张发给消费者的账单。首先,我需要差异,然后我可以尝试访问计算账单成本。只是为了让我的用户更友好。提前谢谢。

im not sure how to even start this. im using access 03 to build a db to store my water district meter readings. i have 2 tables so far, 1 consumer info and 2 monthly meter readings. i need a query to bring up the difference between current month meter reading and last months meter reading for each consumer. thats where im stuck because ive never used access to do much of anything at all. so i figured id ask, and here i am. table 1 consumer info doesnt store much except name and address. i may add more info later if needed. table 2 is where the usefull information is stored. it has consumer name, date and meter reading. what i am trying to figure out is how to get the difference between monthly meter readings so i can make a report that will print up a bill to send out to the consumers. first i need the difference then i can try to get access to calculate the bills cost. just trying to make things more user friendly on my part. thanks in advance.

推荐答案

也许我需要为每个消费者提供一张桌子?
maybe i need a table for each consumer?



我不知道怎么开始这个。我使用访问03建立一个数据库来存储我的水区计量读数。到目前为止我有2张桌子,1张消费者信息和2个月度读数。我需要一个查询来调出每个消费者当前月份读数和上个月抄表之间的差异。这就是我陷入困境的原因,因为我从未使用过访问权来做任何事情。所以我想id问,我在这里。表1消费者信息除了名称和地址之外没有多少存储。如果需要,我可以稍后添加更多信息。表2是存储有用信息的地方。它有消费者姓名,日期和抄表。我想弄清楚的是如何获得月度计读数之间的差异,这样我就可以制作一份报告,打印出一张发给消费者的账单。首先,我需要差异,然后我可以尝试访问计算账单成本。只是为了让我的用户更友好。提前致谢。
im not sure how to even start this. im using access 03 to build a db to store my water district meter readings. i have 2 tables so far, 1 consumer info and 2 monthly meter readings. i need a query to bring up the difference between current month meter reading and last months meter reading for each consumer. thats where im stuck because ive never used access to do much of anything at all. so i figured id ask, and here i am. table 1 consumer info doesnt store much except name and address. i may add more info later if needed. table 2 is where the usefull information is stored. it has consumer name, date and meter reading. what i am trying to figure out is how to get the difference between monthly meter readings so i can make a report that will print up a bill to send out to the consumers. first i need the difference then i can try to get access to calculate the bills cost. just trying to make things more user friendly on my part. thanks in advance.



你不需要为每个消费者提供一张桌子,处理日期可能相当棘手,特别是在年度变化时。我认为你想直接处理几个月而不是几天?在处理日期范围时,日期可以更容易一些,但仍有几个月的时间。开始进行查询,获取当前月份所有账单的总和,但在您的消费者名称中作为您的一个列,然后将其汇总到另一列中的仪表读数,并在最后一列中列出您的月份日期字段,我相信你可以使用datepart函数来获得它。那应该是你迈出的第一步,对不起我现在不能再找你了,但这是午餐时间; P

You don''t need a table for each consumer, dealing with dates can be pretty tricky especially when it comes to year changes. I take it you want to deal directly with months and not days? Days can be a bit easier when dealing with date ranges, but months is still possible. Start off making a query that gets the sum of all your bills for the current month, but in your consumer name as one of your columns, then have it sum up your meter readings in another column and in the last column put the month of your date field, I believe you can use the datepart function to get that. That should get you your first step, sorry I can''t get you any more right now, but it''s lunch time ;P


我会尝试一些事情。但每月完成抄表。所以我每个消费者每月只有一个读数。所以这就是为什么我认为我会为每个消费者制作一张桌子,你怎么看?我的日期列的格式为mmddyyy只是为了方便,但是这个月我都在寻找。我在这一部分与一位年长的女士合作,她在这笔交易中唯一的工作就是为消费者输入每月的读数。我们没有得到这个报酬。我只是想让我们从长远来看更轻松。最后,每月投入的唯一信息是每个消费者的抄表和月份。我需要这个数据库给我区分当前月份和上个月的读数。然后生病试图弄清楚如何让db计算账单并从报告中打印出来。这样我就不会在计算器和word文档上做这一切。这有点清楚吗?
well im gonna try a few things. but the meter reading is done monthly. so i only have one meter reading per consumer per month. so thats why i thought i would make a table for each consumer, what do you think? my date column is in the format of mmddyyy just for ease, but the month is all im looking for. i work with an older lady on this part in which her only job on this deal is to input the monthly meter readings for the consumers. we do not get paid for this. im just trying to make things easier on us in the long run. in the end, the only info that gets put in monthly is the meter reading and month for each consumer. i need this db to give me the difference between the reading from the current month and the last month. then ill try to figure out how to make the db calculate the bill and print it from a report. that way i am not doing all this on a calculator and word document. does that clear things up a bit?


这篇关于日期差异计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆