Link to home
Start Free TrialLog in
Avatar of Needful
Needful

asked on

Not able to get a Proper SQL QUerry

Hi Here is my question:

I have a table in Database like

Manager   TicketID   Ticket Arrival
X                111         10-11-2008
Y               112          09-20-2008
X               113          08-22-2008
Y               114          07-22-2008
Z               115          10-5-2008

Now i want a select query which will fetch me results something like this

Manager     NoofTickets     AgingofTickets(0-15 days)    Aging(15-30 days)   Aging(more than 30 days)
X                        2                            0                                       1                                   1
Y                        2                            0                                       0                                   2
Z                        1                            0                                       1                                   0

Where age of ticket is calculated by (Current Date - TicketArrivaldate) and based on that they are placed in 3 categories.

Can anyone tell me the SQL querry to acheive these kind of results.
After this i want to transform that to XmL and they apply XSL to it.

Any kind of help is appreciated
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Needful
Needful

ASKER

Hi Thanks a lot for the above solution:
I have further requirement of converting that to an XML File as shown below:


 
    0
    1
    3
 
 
    0
    1
    3
 
 
    0
    1
    3
 


and then apply XSL:
SO that
Entries of column Age_less_15_days is shown with Green Indicator
Entries of column Age_15_to_30_days is shown with yellow Indicator
Entries of column Age_more_than_30_days is shown with red Indicator

Can you help me with this.
Anyways thanks for your quick response


i am no XML/XSL stuff worker, so I won't really be helpful there..