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

Distinct Query On One Column

Posted on May 20, 2014October 26, 2015 By David Kittell

While this query has more than what may be needed this will help you to get data based on one unique column.

SELECT [File Name]
	,[Division]
	,[Version]
FROM (
	SELECT [File Name]
		,[Division]
		,[Version]
		,row_number() OVER (
			PARTITION BY [Division] ORDER BY [Version] DESC
			) AS RowNumber
	FROM <DatabaseTableName>
	) AS A
WHERE a.RowNumber = 1
	AND (
		[Version] LIKE '%2014%'
		OR [Version] LIKE '%2013%'
		)
Originally Posted on May 20, 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

Post navigation

Previous post
Next post

Related Posts

Ektron Find Replace In Sitemap

Posted on October 23, 2013October 26, 2015

This script will search and replace sitemap links/titles/etc set xact_abort on declare @currurl nvarchar(500) declare @newurl nvarchar(500) declare @search nvarchar(500) declare @replace varchar(500) set @search = ” –string to find set @replace = ” –replacement string declare @pos int declare @id bigint declare @ol int declare @lang int begin tran…

Read More

Delete Duplicate Rows

Posted on April 29, 2013October 26, 2015

CREATE TABLE DuplicateRcordTable (Col1 INT, Col2 INT) INSERT INTO DuplicateRcordTable SELECT 1, 1 UNION ALL SELECT 1, 1 –duplicate UNION ALL SELECT 1, 1 –duplicate UNION ALL SELECT 1, 2 UNION ALL SELECT 1, 2 –duplicate UNION ALL SELECT 1, 3 UNION ALL SELECT 1, 4 GO SELECT * FROM…

Read More

AES Encrypted SSO – C# to PHP

Posted on March 25, 2013October 26, 2015

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="csharp.aspx.cs" Inherits="csharp" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>CSharp to PHP</title> </head> <body> <form id="form1" runat="server"> <div id="divDebugInfo" runat="server" visible="false"> </div> </form> </body> </html> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; #region AES Pass-Through – Start using System.Security.Cryptography; using System.Text;…

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