Click here to Skip to main content
15,896,398 members
Home / Discussions / Database
   

Database

 
GeneralRe: Doing LIKE for a numeric column Pin
Boaz V1-Dec-04 5:14
Boaz V1-Dec-04 5:14 
GeneralDoing LIKE for a numeric column Pin
Menny Even Danan1-Dec-04 4:46
Menny Even Danan1-Dec-04 4:46 
GeneralRe: Doing LIKE for a numeric column Pin
lisoft3-Dec-04 15:15
lisoft3-Dec-04 15:15 
GeneralRe: Doing LIKE for a numeric column Pin
Menny Even Danan5-Dec-04 1:17
Menny Even Danan5-Dec-04 1:17 
GeneralDoing LIKE for a numeric column Pin
Boaz V1-Dec-04 4:43
Boaz V1-Dec-04 4:43 
GeneralRe: Doing LIKE for a numeric column Pin
Colin Angus Mackay1-Dec-04 5:07
Colin Angus Mackay1-Dec-04 5:07 
GeneralRe: Doing LIKE for a numeric column Pin
Chris Meech1-Dec-04 5:17
Chris Meech1-Dec-04 5:17 
GeneralMissing data from result Pin
Andy *M*30-Nov-04 13:14
Andy *M*30-Nov-04 13:14 
Hi,

I have to generate a report but I am having difficulty getting the data
out of the SQL Server. The report is produced daily, weekly or monthly
but my query doesn't work all the time.

The report lists the facilities that are available to be hired out. A
facility is something like a meeting room, or conference hall and so on.
There is also a reservation table that lists when each facility is
booked from and until. The monthly reports seem to work okay, but
sometimes the weekly reports don't contain all the data and frequently
the daily reports are missing data.

The two tables are (I've listed only the keys and the fields I need):
Facility: FacilityId (the primary key), Description, LocationId
FacilityReservation: FacilityReservationId (the primary key), FacilityId
(the foreign key), StartTime, EndTime

What I need is a list of each facility with the amount of time it is
booked for. My SQL is:
SELECT f.FacilityId, f.LocationId, tu.TimeUtilized
FROM Facility AS f
INNER JOIN (
SELECT Facility.FacilityID, SUM(DATEDIFF(minute, StartTime,
EndTime)) AS TimeUtilized
FROM FacilityReservation
INNER JOIN Facility ON Facility.FacilityId =
FacilityReservation.FacilityId
WHERE StartTime BETWEEN @ReportStartTime AND @ReportEndTime
GROUP BY Facility.FacilityID) AS tu ON f.FacilityID = tu.FacilityID

Does anyone have any ideas why there is missing data?

Cheers,
Andy
GeneralRe: Missing data from result Pin
Andy *M*30-Nov-04 13:39
Andy *M*30-Nov-04 13:39 
GeneralWin 2000, .net deployment Pin
Member 155577930-Nov-04 9:10
Member 155577930-Nov-04 9:10 
GeneralUnusual INSERT INTO problem using ADO, C# and MSAccess DB Pin
donmorr30-Nov-04 7:01
donmorr30-Nov-04 7:01 
GeneralRe: Unusual INSERT INTO problem using ADO, C# and MSAccess DB Pin
Luis Alonso Ramos30-Nov-04 8:11
Luis Alonso Ramos30-Nov-04 8:11 
GeneralRe: Unusual INSERT INTO problem using ADO, C# and MSAccess DB Pin
donmorr30-Nov-04 8:23
donmorr30-Nov-04 8:23 
GeneralRe: Unusual INSERT INTO problem using ADO, C# and MSAccess DB Pin
Anonymous1-Dec-04 1:59
Anonymous1-Dec-04 1:59 
GeneralDataset 2 Xml - attribute problem Pin
Xabatcha30-Nov-04 3:11
Xabatcha30-Nov-04 3:11 
GeneralAdding large strings (greater than 255chars) to Access DB via c# ADO Pin
donmorr30-Nov-04 2:19
donmorr30-Nov-04 2:19 
GeneralRe: Adding large strings (greater than 255chars) to Access DB via c# ADO Pin
Luis Alonso Ramos1-Dec-04 17:59
Luis Alonso Ramos1-Dec-04 17:59 
Generalraising event from SQL-Server to C# Pin
TehMedic29-Nov-04 21:07
TehMedic29-Nov-04 21:07 
GeneralRe: raising event from SQL-Server to C# Pin
Colin Angus Mackay30-Nov-04 5:30
Colin Angus Mackay30-Nov-04 5:30 
GeneralADO connection to NT Personal Oracle Pin
Member 155378429-Nov-04 18:13
Member 155378429-Nov-04 18:13 
GeneralRecord is killed after UPDATE Pin
realmontanakid29-Nov-04 11:04
realmontanakid29-Nov-04 11:04 
GeneralRe: Record is killed after UPDATE Pin
realmontanakid29-Nov-04 20:43
realmontanakid29-Nov-04 20:43 
GeneralCopy rows from one table from another Pin
Luis Alonso Ramos29-Nov-04 9:23
Luis Alonso Ramos29-Nov-04 9:23 
GeneralRe: Copy rows from one table from another Pin
Edbert P29-Nov-04 10:56
Edbert P29-Nov-04 10:56 
GeneralRe: Copy rows from one table from another Pin
Luis Alonso Ramos29-Nov-04 11:22
Luis Alonso Ramos29-Nov-04 11:22 

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.