This can be done very simple, you were pretty close already
SELECT distinct id, DENSE_RANK() OVER (ORDER BY id) AS RowNum
FROM table
WHERE fid = 64
More Related Contents:
- How do I (or can I) SELECT DISTINCT on multiple columns?
- SQL/mysql – Select distinct/UNIQUE but return all columns?
- Is there any difference between GROUP BY and DISTINCT
- Group by minimum value in one field while selecting distinct rows
- How to use DISTINCT and ORDER BY in same SELECT statement?
- SQL to find the number of distinct values in a column
- Eliminating duplicate values based on only one column of the table
- MySQL: Select DISTINCT / UNIQUE, but return all columns?
- Huge performance difference when using GROUP BY vs DISTINCT
- Produce DISTINCT values in STRING_AGG
- SQL distinct for 2 fields in a database
- How to select records without duplicate on just one field in SQL?
- Select distinct from multiple fields using sql
- SQL query with distinct and sum
- LIMIT 10..20 in SQL Server
- Alter a MySQL column to be AUTO_INCREMENT
- Delete column from SQLite table
- @@IDENTITY, SCOPE_IDENTITY(), OUTPUT and other methods of retrieving last identity
- How to delete from select in MySQL?
- The new PIVOT function in BigQuery
- How to get the first and last date of the current year?
- Combine two tables for one output
- How to split string using delimiter char using T-SQL?
- Match only entire words with LIKE?
- PostgreSQL convert columns to rows? Transpose?
- SQL Inner join more than two tables
- What does ON [PRIMARY] mean?
- MySQL SELECT x FROM a WHERE NOT IN ( SELECT x FROM b ) – Unexpected result
- selecting top N rows for each group in a table
- Getting warning: Null value is eliminated by an aggregate or other SET operation