Hi,
I am creating a attendance sheet software for inhouse use.
my data is like this:-
------------------------------------------------------------------------------------------------
| name | login time | logout
time |
------------------------------------------------------------------------------------------------
| a | 2007-11-10 12:00:00 | 2007-11-10
16:00:00 |
------------------------------------------------------------------------------------------------
| b | 2007-11-10 15:00:00 | 2007-11-10
18:00:00 |
------------------------------------------------------------------------------------------------
My requirement:-
I want to generate an hourly report like this:-
--------------------------------------------------------------------------------------------
date time range total people logged
in
---------------------------------------------------------------------------------------------
2007-11-10 0 -2 0
--------------------------------------------------------------------------------------------
2007-12-10 2-4 0
--------------------------------------------------------------------------------------------
..
..
-------------------------------------------------------------------------------------------
2007-11-10 12-14 1
-------------------------------------------------------------------------------------------
2007-11-10 14-16 2
--------------------------------------------------------------------------------------------
2007-11-10 16-18 1
------------------------------------------------------------------------------------------------
..
..
---------------------------------------------------------------------------------------------
2007-11-10 22-24 0
--------------------------------------------------------------------------------------------
This is what I want to creat , but I don't know how can I generate
such kind of report.
Can you please guide me for the same. Please reply urgently.
Thanks & Regards,
Bhishm 2 1433
Hi Bhishm,
I'm afraid you will need to supply a lot more information than this.
What table(s) exist for storing these details? What technology are you
using to design the report? What does the "Time Range" value in the
report represent (looks like hours?) Do you simply need a SQL
Statement to prepare data in the "report" format you specified?
If I simply assume that everything un-said is as I imagine it, I guess
the solution might be something like:
/* Initialise data table */
CREATE TABLE tblLog (LogName nvarchar(50), LogInTime datetime,
LogOutTime datetime)
INSERT INTO tblLog (LogName, LogInTime, LogOutTime)
SELECT 'personA', '2007-11-10T12:00:00', '2007-11-10T16:00:00'
UNION ALL
SELECT 'personB', '2007-11-10T15:00:00', '2007-11-10T18:00:00'
UNION ALL
SELECT 'personC', '2007-11-10T11:00:00', '2007-11-10T14:00:00'
/* Create supporting table */
CREATE TABLE HrInDay (HrMin INT, HrMax INT, TimeRange VARCHAR(10))
DECLARE @i INT, @Date VARCHAR(8)
SET @i = 0
SET @Date = '20071110' -- Date parameter for "Report"
WHILE @i < 24
BEGIN
INSERT INTO HrInDay (HrMin, HrMax, TimeRange)
VALUES (@i, @i + 2, CAST(@i AS VARCHAR) + ' - ' + CAST(@i + 2 AS
VARCHAR))
SET @i = @i + 2
END
/* Select from a derived table so it's sorted - there is probably a
better way to do this but I'm too lazy to find it :) */
SELECT LogDate, TimeRange, NoPplLogged
FROM (
SELECT @Date AS LogDate,
MAX(TimeRange) AS TimeRange,
HrMin,
COUNT(DISTINCT LogName) AS NoPplLogged
FROM tblLog
RIGHT JOIN HrInDay
ON DATEPART(hh, LogInTime) < HrMax
AND DATEPART(hh, LogOutTime) HrMin
AND CONVERT(VARCHAR (8), LogInTime, 112) = @Date
GROUP BY HrMin
) AS Report
DROP TABLE HrInDay
DROP TABLE tblLog
Good luck!
J
Thanks a lot :) JhofM for showing the way.
I got a lot of help from it in solving it.
Now I am looking into possilities and will let you know my results.
Thanks a lot again, it's of great help This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jenny |
last post by:
Need urgent help for an unsolved problem. In our ASP web application,
we creat a Back button and if user click on this button, it execute
history.go(-1) to go back to the previous page. All our users use IE
6.0 and most of them don't have problem with this button. But one user
reported everytime he click on this button, there is a pop-up window
shows up and ask him refresh and reload the page, after he clicks OK,
the previous page will be...
|
by: Rahul S. |
last post by:
Hey all:
I need urgent information how to set the environment in Visual.NET
wiritng in C.
I am working with a licensed version of the Analyze 6.0 software from
mayo clinic. I need to write code in C using AVW functions that are
licensed by Mayo clinic.
In order to access the AVW library of functions, I need to set the
|
by: |
last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I
keep getting the following error:-
Error In:
http://www.mywebsite.org/WebResource.axd?d=5WvLfhnJp5Lc8WhQSD4gdA2&t=632614619884218750
--------------------------------------------------------------------------------
System.Security.Cryptography.CryptographicException: Padding is invalid and
cannot be removed. at...
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to
communicate with a MySQL database table on a web server, from inside
of my company's Access-VBA application. I know VBA pretty well but
have never before needed to do this HTTP/XML/MySQL type functions.
|
by: Max Power |
last post by:
Hi All
I am coding a small app in that swaps specific files between a client and
server. All files and locations are set at both sides.
I want my app to show a file list, based on the file names, from the local
and remote machine.....
Local is not a problem and works OK. but I am trying ::
Form1.getFile.FileName = Inet1.Execute("ftp://ftp.server.net", "DIR") and I
| |
by: TexCube |
last post by:
Hello everyone,
I have an urgent question. Can data be pulled from an access database table to create a directory that can be printed out and bound together?
I need to have each row of a database populate a preset page that will be used as a classmate directory. Each page will have info pertinent to an individual classmate. (one page per classmate) I don't want to input the data into a form since it's already been done into an Excel...
|
by: David Thielen |
last post by:
Hi;
I have help html pages for each page of my ASP.NET webapp. So for the page
datasource.aspx, I have help\datasource.htm.
Bu what I want when the hyperlink is clicked, for it to look for the
following files in order (assuming I am running from the us):
help\datasource_en_US.htm
help\datasource_en.htm
help\datasource.htm
|
by: sanjayhire |
last post by:
Hi All,
I have just joined the forum.
I need your help..As it's very urgent...
How to identify a particular process is running on a server(Windows/Unix server) using VB program and since how long a process is running?
Please help me out..
Thanks in advance.
|
by: psantosh12 |
last post by:
Hello Frnds
Please need help to resolve error.......... it is very very urgent........
The error is
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of...
|
by: Justin |
last post by:
Here's my XML:
<?xml version="1.0" ?>
<AppMode Type="Network">
<CurrentFolder Path="c:\tabs">
<Tabs>
<FilePath>tabs\Justin.tab</FilePath>
<FilePath>tabs\Julie.tab</FilePath>
*****There could be 1 of these or 100....quantity can change*****
</Tabs>
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |