开发者

Design table to support one row per day per employee

开发者 https://www.devze.com 2022-12-08 15:48 出处:网络
Storing daily stats for employees, and I want to store daily sales per employee (required for reporting, please don\'t argue the design! lol )开发者_开发知识库

Storing daily stats for employees, and I want to store daily sales per employee (required for reporting, please don't argue the design! lol )开发者_开发知识库

Table:

EmployeeID DateStamp

I figure I should make the datestamp a smalldatetime since I don't need that much accurancy.

What should my query look like to see if there is an entry for the user for the given day?

Update Actually, I have to see if the current day has a record, if not, then reset the older record with todays date and clear the salesAmount column.


You could try something like

SELECT * WHERE employeeID = 'ID' AND DateStamp = 'Date'

That should then pull all of the row's information where those two criteria are met.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号