0

I have a table named "LOAN" with Columns - "CustomerID, Name, Address, LoanAmount, DisbursementDate, InstallmentDate".

There are 1,000,000 records in this table. I need to find out the contents of table in Row Number 400,000.

Is there a way to find out the record if Row Number is provided?

I'm executing the query in SQL Server

--I tried using Count(*) in where condition , but that threw an error.

select * from LOAN where Count(*)=400,000 --ERROR: aggregate Func. cannot be used in Where clause

--Tried using count(*) in having clause, but that resulted in a blank output.

Select Name from LOAN group by Name having Count(*)=400,000

--Then tried using @@RowCount, but that didn't work either

Select * from LOAN where @@RowCount=400,000. 
P Mishra
  • 13
  • 4
  • 1
    Use a CTE to define the `ROW_NUMBER` and then filter on that? Of course, what the value of `ROW_NUMBER` is is completely dependant on your `ORDER BY` clause. – Thom A Jan 18 '23 at 10:09

0 Answers0