Microsoft
Software
Hardware
Network
Question : SQL- Find the diferrence, above or below target
I've got a sales target - say 7,500
How in sql can I tell if a figure is below or above that target.
eg
If the target was 7,500 and the TotalSales was 7,571.55 then I'd want to display in another column called UntilTarget -£71.55 (above Target)
If the targetwas 7,500 and the TotalSales was 7,428.45 then I'd want to display in another column called UntilTarget £71.55 (below Target)
How do I write this in SQL
Thanks
Answer : SQL- Find the diferrence, above or below target
Hello edjones1,
Assuming both are from the same table or view...
SELECT TargetSales, TotalSales, TargetSales - TotalSales AS Variance
FROM SomeTableOrView
Regards,
Patrick
Random Solutions
Stop message/warnings when running pass through query
Moving SID History
Search on part of word only...?
Average from column with empty cells.
Excel Application WindowState xlNormal
How to Bind A dataset to the the datagrid in C# windows...it shows the table in the dataset but i cannot bind the dataset to the datagrid..Can any one hepl PLz
Delete Function for single record in ADO has one line returns error
Querying Query Results in VB.NET
Excel macro to find all instances
EF4 + WCF Self Tracking Entities problem