Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server Newbies
»
how to manage to get the range Id of a...
how to manage to get the range Id of a specific number of minutes
Rate Topic
Display Mode
Topic Options
Author
Message
DZN61
DZN61
Posted Thursday, August 30, 2012 6:52 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, December 19, 2012 4:05 AM
Points: 24,
Visits: 60
Hi
I can imagine that the subject is not clear at all...
So let's give you an example.
I have a table with dates (begin, end) and an elapsed time in minutes.
1 2012-01-01 08:00 21-01-01 10:00 60
2 2012-06-01 10:12 21-06-01 18:13 481
etc ....
I have another table with minutes range
ID Title Range MinutesRangeBegin MinutesRangeEnd
1 < 15 min 0 15
2 >15 min < 30 min 16 30
3 >31 min < 1h 31 60
4 >1h < 8h01 61 481
5 >1day < 2 days 14401 28800
....etc......
I would like this kind of result :
inital table Range Id (added)
1 2012-01-01 08:00 21-01-01 10:00 60 3
2 2012-06-01 10:12 21-06-01 18:13 481 4
How achieved this with a select statement ?
Post #1352164
cnporteous
cnporteous
Posted Thursday, August 30, 2012 6:58 AM
SSC Journeyman
Group: General Forum Members
Last Login: Thursday, April 25, 2013 4:21 AM
Points: 92,
Visits: 95
Hey,
Without typing it out for you, have a look at this example. Same idea as what you need.
Thanks
http://social.msdn.microsoft.com/Forums/en/sqldatabaseengine/thread/36f70eed-68c7-4d0e-8967-aa366780c8b2
Post #1352171
DZN61
DZN61
Posted Thursday, August 30, 2012 7:10 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, December 19, 2012 4:05 AM
Points: 24,
Visits: 60
Tks for quick reaction. I will have a look on it!
Post #1352181
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.