Showing posts with label max. Show all posts
Showing posts with label max. Show all posts

Monday, March 26, 2012

Running Totals with Max/Min Values

I am creating a timesheet report that calculates a running total of hours for the week by day. However, I want to be able to create two running totals for the entered time for the week. One that will max at 40 hours (reg. hours) and the second will start after 40 hours (overtime).

Any ideas?

Thanks!Use two Running totals
Reset first when it reaches 40
and start other when it over 40sql

Tuesday, February 21, 2012

running SQL file (view + procedure) problem


I am try to run a .sql file
CREATE VIEW LastReport
AS
SELECT MAX(ID) AS LastReport, RHost
FROM Report
WHERE (RComplete = 1)
GROUP BY RHost
CREATE PROCEDURE [dbo].[MembresAcces_Insert]
AS
INSERT INTO membresAcces (login, passe, id_membresTypes) VALUES ('admin','admin',50);

... 10 view and procedure like this one
i get an error view must be the first one
what is wrong ? running CREATE TABLE works perfectly
thank you


Try placing a GO in between each statement.
CREATE VIEW LastReport
AS
SELECT MAX(ID) AS LastReport, RHost
FROM Report
WHERE (RComplete = 1)
GROUP BY RHost
GO
CREATE PROCEDURE [dbo].[MembresAcces_Insert]
AS
INSERT INTO membresAcces (login, passe, id_membresTypes) VALUES ('admin','admin',50);
GO