Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


how to manage to get the range Id of a specific number of minutes


how to manage to get the range Id of a specific number of minutes

Author
Message
DZN61
DZN61
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
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 ?
cnporteous
cnporteous
SSC Journeyman
SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)SSC Journeyman (93 reputation)

Group: General Forum Members
Points: 93 Visits: 121
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
DZN61
DZN61
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 Visits: 60
Tks for quick reaction. I will have a look on it!
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search