Stored Procedure or Creat a View??

Discussion in 'Software' started by xcas08, Mar 14, 2007.

  1. xcas08

    xcas08 Private E-2

    Hello all I am not quite a beginner but not an expert at SQL. I'm kind of in a bind and need some help. I have a table that shows me statuses of tickets (open, pending, closed), some tickets could have as much as 25 rows/ticket. I want to try to avoid that but at the same time keep track of the time. Here's what I need to happen...

    with the data example below I need to take the ((closed date - first open date) - total of Waiting time). This will give me total time duration of the ticket. I'd like to either write a stored procedure or create a view that would do this for me. Any one have ideas?

    CallID DateStop TimeStop CallStatus
    00216177 2006-01-20 05:39:24 Open
    00216177 2006-01-20 05:39:27 Open
    00216177 2006-01-20 05:40:13 Open
    00216177 2006-01-20 05:40:24 Pending
    00216177 2006-02-07 16:05:47 Pending
    00216177 2006-02-21 17:26:22 Pending
    00216177 2006-02-21 17:29:06 Pending
    00216177 2006-02-21 17:29:08 Open
    00216177 2006-03-03 16:35:10 Open
    00216177 2006-04-05 15:12:26 Open
    00216177 2006-04-05 15:17:09 Open
    00216177 2006-04-14 14:37:49 Open
    00216177 2006-04-14 14:37:54 Awaiting
    00216177 2006-04-19 11:20:30 Awaiting
    00216177 2006-04-19 12:12:34 Awaiting
    00216177 2006-04-19 12:12:37 Awaiting
    00216177 2006-04-19 12:12:58 Awaiting
    00216177 2006-04-19 12:13:00 Closed
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds