Click here to Skip to main content
15,909,898 members
Home / Discussions / Database
   

Database

 
QuestionTo fetch the data from different tables Pin
srikantha_nagaraj5-Aug-09 3:45
srikantha_nagaraj5-Aug-09 3:45 
AnswerRe: To fetch the data from different tables Pin
Mycroft Holmes5-Aug-09 22:13
professionalMycroft Holmes5-Aug-09 22:13 
AnswerRe: To fetch the data from different tables Pin
Kschuler7-Aug-09 9:48
Kschuler7-Aug-09 9:48 
Questionstop select case creating new rows? Pin
Tommy Pickersgill5-Aug-09 2:33
Tommy Pickersgill5-Aug-09 2:33 
AnswerRe: stop select case creating new rows? Pin
WoutL5-Aug-09 3:29
WoutL5-Aug-09 3:29 
GeneralRe: stop select case creating new rows? Pin
Tommy Pickersgill5-Aug-09 3:51
Tommy Pickersgill5-Aug-09 3:51 
GeneralRe: stop select case creating new rows? Pin
WoutL5-Aug-09 9:25
WoutL5-Aug-09 9:25 
AnswerRe: stop select case creating new rows? Pin
Tommy Pickersgill5-Aug-09 6:46
Tommy Pickersgill5-Aug-09 6:46 
Can anyone else offer any more on this? Sorry for the spam but it's quite urgent. I've tried playing about with it more by placing the case inside the JOIN - which I got my hopes up about but still the same result of recieving multiple user rows with different worklogs Mad | :mad:

ALTER procedure [dbo].[GetAllUsersWhoHaventSubmittedTimeForWeek]
(
@MinimumHours float,
@EndDate datetime,
@AmountOfDaysBack int
)
as
begin
SELECT	u.Email,
		u.FirstName + ' ' + u.LastName AS Usersname,
		w.WorkDone
from Users u LEFT OUTER JOIN 
	( 
	Select	UserID,
			WorkUnitTypeId,
			CASE WorkUnitTypeId
			WHEN 1 THEN ISNULL(round(sum(WorkDone / 60),1), 0)	--Minutes
			WHEN 2 THEN ISNULL(round(sum(WorkDone),1), 0)		--Hours
			WHEN 3 THEN ISNULL(round(sum(WorkDone * 24),1), 0)	--Days
			WHEN 4 THEN ISNULL(round(sum(WorkDone * 168),1), 0)	--Weeks
			ELSE 0
			END as WorkDone
			FROM worklog
			WHERE WorkLogDateTime >= dateadd(d, -@AmountOfDaysBack, @EndDate) and WorkLogDateTime <= dateadd(d, 1, @EndDate)
			--HAVING round(sum(WorkDone) / 60, 1) < @MinimumHours
			GROUP BY	UserId, 
						WorkUnitTypeId
	) w
ON u.UserId=w.UserId
WHERE u.userid not in (SELECT User_ID FROM ReportUsers WHERE Status = 0) and u.isactive = 1
GROUP BY w.UserId,
			u.FirstName,
			u.LastName,
			u.Email,
			WorkUnitTypeId,
			WorkDone
ORDER BY sum(WorkDone) DESC

END

GeneralRe: stop select case creating new rows? Pin
i.j.russell5-Aug-09 11:39
i.j.russell5-Aug-09 11:39 
GeneralRe: stop select case creating new rows? [modified] Pin
Tommy Pickersgill5-Aug-09 23:06
Tommy Pickersgill5-Aug-09 23:06 
QuestionDesigning Table to Record Hierarchy Pin
vhassan5-Aug-09 0:58
vhassan5-Aug-09 0:58 
QuestionSQL Server config Pin
helelark1234-Aug-09 6:13
helelark1234-Aug-09 6:13 
AnswerRe: SQL Server config Pin
leckey4-Aug-09 16:02
leckey4-Aug-09 16:02 
GeneralRe: SQL Server config Pin
helelark1234-Aug-09 18:44
helelark1234-Aug-09 18:44 
AnswerRe: SQL Server config Pin
N a v a n e e t h4-Aug-09 17:52
N a v a n e e t h4-Aug-09 17:52 
GeneralRe: SQL Server config Pin
helelark1234-Aug-09 18:46
helelark1234-Aug-09 18:46 
QuestionThe ORA-01033: ORACLE initialization or shutdown in progress Pin
vikash_singh4-Aug-09 5:59
vikash_singh4-Aug-09 5:59 
AnswerRe: The ORA-01033: ORACLE initialization or shutdown in progress Pin
suresh.palghar1-Sep-09 23:31
suresh.palghar1-Sep-09 23:31 
QuestionLoading(Importing) Data into SQL Server 2005 Pin
sm_sadhik4-Aug-09 5:00
sm_sadhik4-Aug-09 5:00 
AnswerRe: Loading(Importing) Data into SQL Server 2005 Pin
i.j.russell5-Aug-09 11:42
i.j.russell5-Aug-09 11:42 
QuestionInvalid column name error? Pin
cdietschrun4-Aug-09 4:25
cdietschrun4-Aug-09 4:25 
AnswerRe: Invalid column name error? Pin
Blue_Boy4-Aug-09 4:44
Blue_Boy4-Aug-09 4:44 
GeneralRe: Invalid column name error? Pin
cdietschrun4-Aug-09 4:50
cdietschrun4-Aug-09 4:50 
GeneralRe: Invalid column name error? Pin
cdietschrun4-Aug-09 4:58
cdietschrun4-Aug-09 4:58 
GeneralRe: Invalid column name error? [modified] Pin
Blue_Boy4-Aug-09 5:40
Blue_Boy4-Aug-09 5:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.