CREATE TABLE #Diamonds (AccountId int, UserId int, IsEmpl...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Diamond data from stackoverflow on 2017-05-01T18:04:04.942Z (93 rows):
CREATE TABLE #Diamonds (AccountId int, UserId int, IsEmployee bit, CreationDate datetime, DisplayName nvarchar(max));
INSERT INTO #Diamonds VALUES (41, 51, 1, '2008-08-01 13:31:13', 'Yaakov Ellis')
INSERT INTO #Diamonds VALUES (1345480, 1440629, 1, '2012-06-06 19:19:53', 'Will Cole')
INSERT INTO #Diamonds VALUES (10049901, 7458866, 1, '2017-01-23 17:07:15', 'Vasudha Swaminthan')
INSERT INTO #Diamonds VALUES (1703573, 1849664, 0, '2012-11-24 15:01:09', 'Undo')
INSERT INTO #Diamonds VALUES (20808, 50049, 1, '2008-12-30 02:30:04', 'Tim Post')
INSERT INTO #Diamonds VALUES (113304, 298479, 0, '2010-03-21 15:14:01', 'ThiefMaster')
INSERT INTO #Diamonds VALUES (2524075, 2193767, 0, '2013-03-21 05:37:59', 'TheLostMind')
INSERT INTO #Diamonds VALUES (1170, 1553, 1, '2008-08-16 15:43:17', 'Tall Jeff')
INSERT INTO #Diamonds VALUES (1246026, 1618182, 1, '2012-08-22 21:16:03', 'stevvve')
INSERT INTO #Diamonds VALUES (49748, 148260, 1, '2009-07-31 04:09:04', 'Steve Trout')
INSERT INTO #Diamonds VALUES (1992677, 5468799, 1, '2015-10-20 19:53:20', 'Sonny Kim')
INSERT INTO #Diamonds VALUES (620, 811, 1, '2008-08-09 03:53:10', 'Shog9')
INSERT INTO #Diamonds VALUES (482412, 896802, 1, '2011-08-16 13:55:02', 'samthebrand')
INSERT INTO #Diamonds VALUES (363391, 707111, 0, '2011-04-08 20:01:10', 'Ryan')
INSERT INTO #Diamonds VALUES (39819, 115049, 1, '2009-05-31 08:58:13', 'rossipedia')
INSERT INTO #Diamonds VALUES (36137, 102937, 0, '2009-05-07 14:45:58', 'Robert Harvey')
INSERT INTO #Diamonds VALUES (34933, 98786, 1, '2009-04-30 17:32:10', 'Robert Cartaino')
INSERT INTO #Diamonds VALUES (179006, 411343, 1, '2010-08-04 22:18:12', 'rla4')
INSERT INTO #Diamonds VALUES (42117, 122607, 1, '2009-06-14 01:02:17', 'Pops')
INSERT INTO #Diamonds VALUES (1190, 1583, 1, '2008-08-16 20:54:12', 'Oded')
INSERT INTO #Diamonds VALUES (272910, 564240, 1, '2011-01-05 16:30:12', 'Nicolas Chabanovsky')
INSERT INTO #Diamonds VALUES (59521, 178082, 1, '2009-09-23 21:16:00', 'Nick Larsen')
INSERT INTO #Diamonds VALUES (7598, 13249, 1, '2008-09-16 17:53:10', 'Nick Craver')
INSERT INTO #Diamonds VALUES (75, 91, 1, '2008-08-01 17:55:22', 'Michael Stum')
INSERT INTO #Diamonds VALUES (7745, 13531, 0, '2008-09-16 19:39:52', 'Michael Myers')
INSERT INTO #Diamonds VALUES (81168, 229044, 0, '2009-12-10 18:20:20', 'meagar')
INSERT INTO #Diamonds VALUES (64170, 189572, 1, '2009-10-14 03:42:37', 'Max')
INSERT INTO #Diamonds VALUES (26961, 70613, 1, '2009-02-24 23:50:14', 'Matt Sherman')
INSERT INTO #Diamonds VALUES (199576, 444991, 0, '2010-02-16 17:27:55', 'Matt')
INSERT INTO #Diamonds VALUES (35417, 100297, 0, '2009-05-03 14:53:57', 'Martijn Pieters')
INSERT INTO #Diamonds VALUES (11975, 23354, 1, '2008-09-29 05:46:02', 'Marc Gravell')
INSERT INTO #Diamonds VALUES (466356, 871050, 0, '2011-07-30 20:57:35', 'Madara Uchiha')
INSERT INTO #Diamonds VALUES (51875, 155005, 1, '2009-08-12 11:30:22', 'm0sa')
INSERT INTO #Diamonds VALUES (5128683, 4109723, 1, '2014-10-05 02:39:31', 'Kurtis Beavers')
INSERT INTO #Diamonds VALUES (77247, 220619, 1, '2009-11-28 20:15:50', 'Korneel Bouman')
INSERT INTO #Diamonds VALUES (3201, 4574, 1, '2008-09-04 18:16:02', 'Konamiman')
INSERT INTO #Diamonds VALUES (996254, 1012097, 1, '2011-10-25 04:45:26', 'Kirti Thorat')
INSERT INTO #Diamonds VALUES (29738, 80572, 1, '2009-03-20 16:35:32', 'Kevin Montrose')
INSERT INTO #Diamonds VALUES (7566321, 5741738, 1, '2016-01-04 00:01:12', 'kcpike')
INSERT INTO #Diamonds VALUES (109934, 472021, 1, '2010-10-11 07:05:26', 'Kasra Rahjerdi')
INSERT INTO #Diamonds VALUES (87273, 242131, 1, '2010-01-02 02:04:04', 'Juice')
INSERT INTO #Diamonds VALUES (6254215, 5012521, 1, '2015-06-15 18:11:17', 'Juan M')
INSERT INTO #Diamonds VALUES (7356150, 6377969, 1, '2016-05-24 19:43:19', 'js12')
INSERT INTO #Diamonds VALUES (3717584, 3093387, 0, '2013-12-12 00:05:56', 'josliber')
INSERT INTO #Diamonds VALUES (1083, 1438, 1, '2008-08-15 15:44:20', 'Jon Ericson')
INSERT INTO #Diamonds VALUES (1303256, 1252759, 0, '2012-03-06 16:43:45', 'Jon Clements')
INSERT INTO #Diamonds VALUES (1036558, 1043674, 1, '2011-11-12 23:20:56', 'Jon Chan')
INSERT INTO #Diamonds VALUES (4, 4, 1, '2008-07-31 14:22:31', 'Joel Spolsky')
INSERT INTO #Diamonds VALUES (10527523, 7782017, 1, '2017-03-28 19:32:06', 'Joe Friend')
INSERT INTO #Diamonds VALUES (1399708, 1328704, 1, '2012-04-12 09:34:45', 'JNat')
INSERT INTO #Diamonds VALUES (2184621, 1933347, 1, '2012-12-28 00:04:27', 'jmac')
INSERT INTO #Diamonds VALUES (21721, 53037, 1, '2009-01-08 18:00:51', 'Jin')
INSERT INTO #Diamonds VALUES (851, 1114, 1, '2008-08-12 12:54:42', 'Jeremy Banks')
INSERT INTO #Diamonds VALUES (1, 1, 1, '2008-07-31 14:22:31', 'Jeff Atwood')
INSERT INTO #Diamonds VALUES (140824, 347414, 1, '2010-05-21 19:48:21', 'Jaydles')
INSERT INTO #Diamonds VALUES (423355, 802695, 1, '2011-06-17 04:52:51', 'Jason Shantz')
INSERT INTO #Diamonds VALUES (4188, 6212, 1, '2008-09-12 23:45:27', 'Jason Punyon')
INSERT INTO #Diamonds VALUES (3, 3, 1, '2008-07-31 14:22:31', 'Jarrod Dixon')
INSERT INTO #Diamonds VALUES (3109039, 2640230, 1, '2013-08-01 01:07:14', 'Hynes')
INSERT INTO #Diamonds VALUES (2815887, 2420979, 1, '2013-05-25 19:20:03', 'Haney')
INSERT INTO #Diamonds VALUES (463168, 865899, 1, '2011-07-27 16:37:22', 'hairboat')
INSERT INTO #Diamonds VALUES (102159, 274402, 1, '2010-02-16 13:44:37', 'Grace Note')
INSERT INTO #Diamonds VALUES (9063, 16587, 0, '2008-09-17 18:43:55', 'George Stocker')
INSERT INTO #Diamonds VALUES (2, 2, 1, '2008-07-31 14:22:31', 'Geoff Dalgas')
INSERT INTO #Diamonds VALUES (5960, 9835, 1, '2008-09-15 20:08:18', 'Gabe')
INSERT INTO #Diamonds VALUES (557741, 920295, 1, '2011-08-30 18:26:43', 'g3rv4')
INSERT INTO #Diamonds VALUES (56144, 168175, 0, '2009-09-03 21:34:08', 'Flexo')
INSERT INTO #Diamonds VALUES (2348349, 2057919, 0, '2013-02-10 00:12:34', 'Ed Cottrell')
INSERT INTO #Diamonds VALUES (5161054, 4406529, 1, '2014-12-30 20:06:50', 'Donna')
INSERT INTO #Diamonds VALUES (7228886, 5516513, 1, '2015-11-02 15:50:06', 'Des')
INSERT INTO #Diamonds VALUES (378, 476, 0, '2008-08-06 08:15:28', 'deceze')
INSERT INTO #Diamonds VALUES (466409, 871146, 1, '2011-07-14 21:19:00', 'Dean Ward')
INSERT INTO #Diamonds VALUES (32917, 91687, 1, '2009-04-16 15:26:22', 'David Fullerton')
INSERT INTO #Diamonds VALUES (-1, -1, 0, '2008-07-31 00:00:00', 'Community')
INSERT INTO #Diamonds VALUES (23619, 59303, 0, '2009-01-27 11:28:18', 'ChrisF')
INSERT INTO #Diamonds VALUES (7846121, 5931150, 1, '2016-02-15 17:11:39', 'Chance Heath')
INSERT INTO #Diamonds VALUES (459488, 860000, 1, '2011-07-24 06:22:50', 'Brian Nickel')
INSERT INTO #Diamonds VALUES (2545189, 2210128, 1, '2013-03-26 04:34:46', 'Bret Copeland')
INSERT INTO #Diamonds VALUES (10416, 19679, 0, '2008-09-20 15:57:51', 'Brad Larson')
INSERT INTO #Diamonds VALUES (37175, 106224, 0, '2009-05-13 11:40:29', 'BoltClock')
INSERT INTO #Diamonds VALUES (93689, 256196, 0, '2010-01-21 21:16:54', 'Bohemian')
INSERT INTO #Diamonds VALUES (188123, 426671, 1, '2010-08-20 19:01:52', 'bluefeet')
INSERT INTO #Diamonds VALUES (5113734, 4099593, 0, '2014-10-01 16:14:48', 'Bhargav Rao')
INSERT INTO #Diamonds VALUES (1653707, 1523776, 1, '2012-07-13 14:06:25', 'Benjamin Hodgson')
INSERT INTO #Diamonds VALUES (40051, 115866, 1, '2009-06-02 08:42:05', 'balpha')
INSERT INTO #Diamonds VALUES (1454845, 1370722, 1, '2012-05-02 18:07:56', 'Aurélien Gasser')
INSERT INTO #Diamonds VALUES (237028, 504912, 1, '2010-11-11 18:41:05', 'Arie Litovsky')
INSERT INTO #Diamonds VALUES (89201, 246246, 1, '2010-01-08 08:44:01', 'animuson')
INSERT INTO #Diamonds VALUES (85975, 239394, 1, '2009-12-28 04:24:10', 'Andrew')
INSERT INTO #Diamonds VALUES (2415655, 2109725, 1, '2013-02-26 04:01:19', 'Ana')
INSERT INTO #Diamonds VALUES (37099, 105971, 1, '2009-05-13 04:45:32', 'Adam Lear')
INSERT INTO #Diamonds VALUES (3337610, 2804712, 1, '2013-09-22 17:14:59', 'Aaron Shekey')
INSERT INTO #Diamonds VALUES (258754, 541136, 0, '2010-12-13 21:54:43', 'Aaron Hall')

SELECT TOP 50
  c.Id [Comment Link], *
FROM
  Comments c INNER JOIN #Diamonds d ON c.UserId = d.UserId
WHERE
  d.IsEmployee = 0
ORDER BY
  c.CreationDate DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results