|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Row Number in SQL Database hi there I am having some query regarding sql. My Question is that How do I provide a distinct unique number to each field returned. I also want to prefer to do it in sql and not to create an index as the table as I don't have sole control of the table. In the below desired output description this would be RowIndex. SQL 2000 Statement to add rowindex to: select distinct(Description) as LawSpecialty from lawspecialty Please help me in this sql qeury |
#2
| |||
| |||
Re: Row Number in SQL Database select * from ( SELECT a.Description, Id = ( SELECT COUNT(1) FROM (SELECT DISTINCT(Description) FROM LawSpecialty ) b WHERE a.Description > b.Description ) +1 FROM (SELECT DISTINCT(Description) FROM LawSpecialty ) A ) C where id in (1,2,3) |
#3
| |||
| |||
Re: Row Number in SQL Database ELECT ROW_NUMBER() OVER (ORDER BY EmployeeName) AS Row, EmployeeId, EmployeeName, Salary FROM Employees which will provide you as output: Row EmployeeId EmployeeName Salary ------------------------------------------- 1 1002 Alden 4000 2 2343 Lawson 4500 3 2004 Barbra 4800 4 1105 Marsden 4500 5 3116 Mac 5000 |
![]() |
|
Tags: oracle, programing language, row number, sql, sql database |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to change the number to private number in BlackBerry 8520? | M@ndy | Portable Devices | 3 | 30-01-2012 06:01 PM |
Should I buy US number or European number hp ink cartridge for HP printer 5160? | Kash123 | Hardware Peripherals | 3 | 16-09-2011 10:56 AM |
Number of Installs reported by Console and the Number of Sales for Paid Apps doesn?t match? | PhoebeM | Portable Devices | 6 | 16-08-2011 10:51 PM |
Vodafone gets the maximum number of users after the mobile number portability | Antariksh | Portable Devices | 5 | 21-03-2011 10:24 AM |
convert filemaker pro database to access database | Czack | MS Office Support | 3 | 15-04-2007 01:06 AM |