Linked Questions
49 questions linked to/from How to select the nth row in a SQL database table?
5 votes
2 answers
14k views
selecting specific rows from database in sql [duplicate]
Possible Duplicate: How to select the nth row in a SQL database table? I have a table that I want to select Select 1 record and in other command I want to select second row and in other command ...
-4 votes
2 answers
3k views
Sql query to select 3rd element from data? [duplicate]
I have written sql query Select * from Products WHERE Products.Category=="Fruits"; the returned answer is 1-Banana 2-Mango 3-Apple 4-Oranges 5-Grapes now i want to select fruit at index ...
-1 votes
2 answers
1k views
Dynamically Loading Content [duplicate]
I am trying to load content as the user scrolls from my database. I am trying to load 10 items at a time in order. currently I have achieved everything I want to do except I am loading the first 10 ...
0 votes
1 answer
2k views
How to fetch Nth row in MySQL? [duplicate]
I am new to MySQL database. So I want to know the exact SQL query to fetch Nth row. Please help me solve this issue. Thanks in advance.
1 vote
2 answers
454 views
MYSQL - Find a record depending on row number [duplicate]
Is it possible to get a table record depending on the row number? For example, I have a table with 40 records and I need to get the 27th record. I need some query like SELECT * FROM my_table WHERE **...
0 votes
0 answers
160 views
SQL query to fetch second last row or nth row from the table [duplicate]
How we can print the second last row from the table using SQL query.
0 votes
3 answers
99 views
Getting the second record using EXCEPT [duplicate]
I want to get the second record from bottom. I tried SELECT TOP 2 meetings_id FROM meetings ORDER BY meetings_date DESC EXCEPT SELECT TOP 1 meetings_id FROM meetings ORDER BY meetings_date DESC But ...
0 votes
0 answers
115 views
How to get fifth highest salary from salary table by single query? [duplicate]
I can get second highest salary by this query. is it possible to use this query for calculate fifth highest salary?? SELECT max(salary) FROM [Employee] where (EmployeeID not in (SELECT max(...
-1 votes
3 answers
109 views
How to get number of a specifc row php [duplicate]
/$sql = "SELECT * FROM tb_cad WHERE name like '$src_names%' ORDER BY id ASC"; $query = mysqli_query($conn, $sql); Id | name ------------ 1 James 2 Claus 7 John 10 Maria 21 ...
0 votes
0 answers
56 views
Select nth row using where condition in oracle database [duplicate]
I have a table having business days stored into it. I want to get 5th business day based on the input date i give. For an example please consider below table BUSINESS DAY 8/06/2004 12:00:00 AM 8/...
213 votes
46 answers
517k views
What is the simplest SQL Query to find the second largest value?
What is the simplest SQL query to find the second largest integer value in a specific column? There are maybe duplicate values in the column.
103 votes
17 answers
138k views
SQL query: Delete all records from the table except latest N?
Is it possible to build a single mysql query (without variables) to remove all records from the table, except latest N (sorted by id desc)? Something like this, only it doesn't work :) delete from ...
24 votes
5 answers
92k views
How to loop through all SQL tables?
We have a piece of software that does not delete entries we no longer want. In order to get a feel for how much data is wasting away in our server and prepare for a big cleanup operation, I am trying ...
11 votes
4 answers
5k views
How to put row on top in mysql query.
Hi i have 100 records in my SQL table i want to sort them ASC by name but i need one record on top of all record nr 43. Is there way i can pull this record 43 first and then everything else ASC order ...
9 votes
5 answers
36k views
How select second line from top 2 or something similar?
I want to execute 2 separated commands to return me a value from my table. the first one could be top 1, because is the first line, no problem... but how can I make something like top 2, but only ...