March 14, 2024 at 7:14 pm
Hi All,
I have domain in Column A. Here I need to count how many domain and need them to flag 1, 2, 3 and so on till maximum. How could I do them in SQL Server. Please find the attachment excel file for reference.
Thanks
March 15, 2024 at 3:06 am
Forum members here will not download files because of possible infections/viruses.
Provide DDL with some sample data with required output.
=======================================================================
March 15, 2024 at 10:29 am
I'm actually not too concerned about opening xlsx files, as they can't contain executable code (as far as I know). I downloaded and virus-scanned this one before I opened it.
Is this the sort of thing you were looking for?
DROP TABLE IF EXISTS #Domain;
CREATE TABLE #Domain
(
Domain VARCHAR(100) NOT NULL
);
INSERT #Domain
(
Domain
)
VALUES
('.uchicago.edu')
,('012.net.il')
,('012.net.il')
,('012.net.il')
,('013net.net');
SELECT d.Domain
,Counts = ROW_NUMBER () OVER (PARTITION BY d.Domain ORDER BY d.Domain)
FROM #Domain d;
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 15, 2024 at 12:32 pm
I'm actually not too concerned about opening xlsx files, as they can't contain executable code (as far as I know). I downloaded and virus-scanned this one before I opened it.
People need to understand that a lot of us don't want to post code solutions without testing them. While I agree that it's fairly trivial for us to convert test data from a spreadsheet to readily consumable data to do such a test, the OP did get the data from somewhere... probably a database. While they're there and, since it is relatively trivial, THEY can provide the test data in readily consumable format.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 21, 2024 at 5:02 pm
This was removed by the editor as SPAM
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply