Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql Help
Message
De
18/12/2009 12:51:50
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
01439765
Message ID:
01439785
Vues:
25
Sybase has CTEs and cross apply. The problem is the 1000lbs is not a constant.

>>>Hi All
>>>I am using a Sybase database but I would think the sql syntax should be almost the same. I have a requirement that I need to calculate fine for overweight trucks. The way the customer wants to do this is to have 1000 pound groups and each group has a progressively higher rate. For example, if a truck is 3500 lbs overweight then the calculation should be:
>>>
>>>1000 * .005   = $5.00
>>>1000 * .01     = 10.00
>>>1000 * .015   = 15.00
>>>500   * .02    = 10.00
>>>for a total of 40.00 
>>>
>>>I tried to create a temp table to hold the rates but I I'm stumped on how to do a join. I was hoping for a SQL solution if it is possible.
>>>
>>>Thanks.
>>
>>BTW, looks like you may use much simpler idea than my cte solution was doing. Just divide the difference in weights by 1000 and join (cross apply) with numbers table to produce records and also use rate*Number to get the rate increase.
>>
>>Do you see the idea or need more information to work it out?
>
>Are you sure Sybase has CTEs and/or CROSS APPLY?
>I don't :-)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform