Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I wanna know how to differentiate a time period in a day between two columns like in time and out time?
Posted
Comments
Thanks7872 25-May-15 3:23am    
What have you tried?

Refer to http://www.w3schools.com/sql/func_datediff.asp[^][datediff^]

For time just use the appropriate abbreviation. Start and end date can be the columns
 
Share this answer
 
Comments
Member 11698441 25-May-15 3:15am    
no while hardcoding the date its given but how to give fr column in table wer to giv FROM<tablename>
Try:
SQL
SELECT DATEDIFF(hh, startDateColumn, endDateColumn) As [Span In Hours] FROM MyTable
 
Share this answer
 
Comments
RossMW 25-May-15 3:18am    
Your quick. Bet me to it ha ha
Member 11698441 25-May-15 3:29am    
the problem is like per day there may be multiple entrys and out i wanna group it and add everything per day
OriginalGriff 25-May-15 3:45am    
So what is the problem? SUM the GROUP difference...
Member 11698441 25-May-15 4:01am    
there are multiple dates and i have to select for individual date
OriginalGriff 25-May-15 4:11am    
You are going to have to explain the whole problem, with the tables and some sample data and the output you expect, rather than you feeding us drips and drabs of information and hoping we luckily fall into the solution you want! :laugh:

Remember that we can't see your screen, access your HDD, or read your mind...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900