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
SQL query to select distinct ID for latest date past June/01/2009 where there are (possibly) more than one occurrence of each ID
User that setup a rule via Outlook 2007 that is forwarding to a dead mailbox...
Change Log on data
How do you combine 2 Outlook.NK2 into one?
replacement for Netscreen Remote VPN
Maximum Length of "net send" message sent to entire domain
Exchange on Windows Server 2008 R2
Workflow: Update List Item using multiple "find" criteria
Access 2K / 2003 bug?
Install SQL 2008 Developer first, then Visual Studio 2008 Professional?