Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Delete Plural if Singular Word also Listed

$
0
0

Looking for an elegant solution: delete plural word IFF singular is present. Sample table:

DECLARE @WordList TABLE (ID INT IDENTITY(1,1) PRIMARY KEY, Word nvarchar(100));
INSERT @WordList (Word) VALUES
('mosquitoes')
,('solo') 
,('zero')
,('embryos') 
,('zeros') 
,('avocado') 
,('embryo') 
,('avocados') 
,('buffaloes') 
,('domino')
,('buffalo') 
,('domino')
,('less')
,('solos')
,('echo') 
,('embargo') 
,('heroes')
SELECT COUNT(*) FROM @WordList;  -- 17


Kalman Toth Database & OLAP Architect SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012







Viewing all articles
Browse latest Browse all 23857

Trending Articles