or this
Main Topics
Browse All TopicsI have the following statement:
select * from tickets
which returns the following:
id | Name | Description | CustomerID | Position
--------------------------
1 | Test1 | Test Ticket | 1 | 1
2 | Test2 | Test Ticket | 1 | 2
4 | Test3 | Test Ticket | 1 | 3
2 | Test4 | Test Ticket | 2 | 1
2 | Test5 | Test Ticket | 2 | 2
So what I want to do is order the tickets and create a time field that spaces them 15 minutes apart.
eg:
id | Name | Description | CustomerID | Position | Due On
--------------------------
1 | Test1 | Test Ticket | 1 | 1 | 09:00
2 | Test2 | Test Ticket | 1 | 2 | 09:15
4 | Test3 | Test Ticket | 1 | 3 | 09:30
2 | Test4 | Test Ticket | 2 | 1 | 09:00
2 | Test5 | Test Ticket | 2 | 2 | 09:15
So as you can see I am looking to create a Due On field, which basically take the time and add 15 minutes onto it for each position found for a customer. Thus spacing the tickets out 15 minutes apart. It would be important that I don;t continue past 23:59 for any given day.
Any ideas on how I can achieve this, I am using SQL Server 2008.
Cheers
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: matthewspatrickPosted on 2009-11-06 at 07:32:04ID: 25759938
SELECT *, DATEADD(minute, 15 * (Position - 1), CONVERT(datetime, '09:00:00')) AS DueOn
FROM SomeTable
ORDER BY CustomerID, Position