473,422 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,422 software developers and data experts.

Query in sqlserver

45
Hi All,

i have this table data based on this i need to display reports.

TimeId EmpNo Date TimeIn TimeOut TotalTime
1 100 8/1/2010 17:00 2:00 9 hours
2 100 8/2/2010 17:00 2:00 9 hours
3 100 8/3/2010 Off Off Off
so on upto 4 weeks data and for all the remaining employees

Based on this data i need to find the percentage of employees who are getting off in the same day.


Out of 100 employees 50 employees may get off in same day say saturday so 50% of the employees are getting off in same day.It can be any day.
I need to find for last 4 weeks,3 weeks,2 weeks.

This week 50 may get on saturday,another 25 may get on sunday still 75% of the employee's are getting off in same day.

Result for last 4 weeks,3 weeks and 2 weeks
Sep 7 '10 #1
4 1264
code green
1,726 Expert 1GB
Out of 100 employees 50 employees may get off in same day
Wow! Can you get me a job there?
You really need to make some attempt at your homework before help is forthcoming.

Break the question down into smaller parts and think how you wish the data to be portrayed.

You will probably make use of COUNT, BETWEEN and the equation for percentage which is total_off/total_empl * 100
Sep 7 '10 #2
Oralloy
988 Expert 512MB
@NareshN,

Code_Green is right. You need to analyze your problem a bit and develop your requirements.

Not just the broad-brush output, but in detail, what is the meaning of each item that you generate.

Once you do that, then the algorithm to compute the values usually becomes obvious.

Also, think of the strange cases that might happen. Perhaps somebody works late Thursday, leaves Friday, comes back Friday and leaves early again on that same day. Is that two people leaving on Friday, or only one?

Anyway - think about what you need, write clear requirements, and we can help you with the details.

Cheers!
Oralloy

@Code_Green, I'm not trying to steal your thunder - just trying to clarify what you wrote in words that I understand.
Sep 7 '10 #3
code green
1,726 Expert 1GB
@Code_Green, I'm not trying to steal your thunder - just trying to clarify what you wrote in words that I understand
Thats OK. But I'm first in line for that job.
Sep 8 '10 #4
Oralloy
988 Expert 512MB
@Code_Green, I'm not trying to steal your thunder - just trying to clarify what you wrote in words that I understand
Thats OK. But I'm first in line for that job.
All yours buddy . . . all yours.
Sep 8 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: tango | last post by:
In Excel VBA, I've established an ODBC connection to a SQLServer db, and I can do a successful SELECT query, but I'm having trouble doing an UPDATE query. When I run the following code, I get...
3
by: Devonish | last post by:
I am planning to convert an existing Access database which has a back end (data tables and relationships only) on a server and a copy of the front end (form, queries, reports) on each of about a...
14
by: Roy Gourgi | last post by:
Hi, I need to store and retrieve information from a database. It looks as though there is a lot more support for SQLServer than there is for Access, correct me if I am wrong. What do I have...
11
by: kirpi | last post by:
There is an SQLServer database somewhere, and I would like to grab and publish some data to my web pages. I was told: "please, do", and given server address, database name, id, and password. My...
1
by: Poul Petersen | last post by:
SQLserver on Small Business Server for Win 2003. Client application updates records in DB. i.e. the content of a field is updated from "First" to "Second" Client application closed and opend...
5
by: alingsjtu | last post by:
Hello, every body. When execute dynamic generated multiple OPENQUERY statements (which linkes to DB2) in SQLServer, I always got SQL1040N The maximum number of applications is already connected...
1
by: Darsin | last post by:
Hi, I have three tables with there fields given in brackets: User: (PK), Divisions: (PK), DivisionsOfUsers: , the "DivisionsOfUsers" tables has many-to-many relationships between userid...
5
by: bobh | last post by:
Hi All, I have this query which updates a field based on the result of an IIF statement. The table is on SQLServer and I'm linked to it and it has many records and will take Access a very long...
2
by: Dinesh | last post by:
Hi experts, I am working on SQL Server 2005. Now i have to write a query which will extract some information from a table. My main table is having few columns supose 3 columns. EmpID ...
12
by: Yash | last post by:
My SQL query is like: SELECT ..... FROM tblCLAIM C INNER join tblXXX .... INNER join tblYYY ....(5 more joins) WHERE C.created_date between @start_date and @end_date AND...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.