Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

MSSQL – Get Percentage

Posted on March 18, 2014October 26, 2015 By David Kittell
SELECT [Lead Status]
	,Count([Lead Status]) AS [Lead Status Total]
	,Cast((Count([Lead Status]) * 1.00) / (
			SELECT Count([Lead Status])
			FROM [table]
			) * 100 AS DECIMAL(10, 2)) AS Percentage
FROM [table]
GROUP BY [Lead Status]
ORDER BY [Lead Status Total] DESC
Originally Posted on March 18, 2014
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code MSSQL SQL

Post navigation

Previous post
Next post

Related Posts

Azure – CLI – Build Windows/UNIX VM Function (With or without public IP)

Posted on December 19, 2017

In the functions below the VM name is used in all of the pieces to build the VM to simplify documentation. Important Items: As I use a Firewall appliance in Azure I do not set Network Security Groups (NSG). I have a predefined virtual network (VN) and predefined network subnet…

Read More

MSSQL – Delta Records

Posted on February 4, 2016February 4, 2016

Scenario: You have to tables with similar information and you need to see what is different Say Table1 & Table2 are two sales contact tables and you want to combine the tables See SQLFiddle for the data schema to allow you to test the queries below. In each example it…

Read More

Mac OSX Terminal – Bash – Convert MP3 to M4R (iPhone Ringtone)

Posted on April 30, 2018

If you have an MP3 that you’d like to use for your iPhone the script below will help you get that file into your ringtone options. #!/bin/sh # ConvertMP3_To_iPhone.sh # # # Created by David Kittell on 4/30/18. # DIR=$1 mkdir -p $DIR/iPhone cd $DIR for f in *.mp3 do…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes