row number mysql

Solutions on MaxInterview for row number mysql by the best coders in the world

showing results for - "row number mysql"
Riordan
27 Apr 2019
1//number of rows retrieved from a query
2<?php
3
4$link = mysql_connect("localhost", "mysql_user", "mysql_password");
5mysql_select_db("database", $link);
6
7$result = mysql_query("SELECT * FROM table1", $link);
8$num_rows = mysql_num_rows($result);
9
10echo "$num_rows Rows\n";
11
12?>
13
14
Giacomo
13 Mar 2018
1SELECT row_number() over ( order by firstName) RowNumberSqeuence,FirstName from rowNumberDemo
2 order by FirstName;
Fabian
06 May 2017
1
2        
3            
4        
5     set @row_number := 0;
6
7SELECT 
8    @row_number:=CASE
9        WHEN @customer_no = customerNumber 
10			THEN @row_number + 1
11        ELSE 1
12    END AS num,
13    @customer_no:=customerNumber customerNumber,
14    paymentDate,
15    amount
16FROM
17    payments
18ORDER BY customerNumber;
Maia
12 Nov 2019
1SET @row_number = 0; 
2SELECT 
3    (@row_number:=@row_number + 1) AS num, 
4    firstName, 
5    lastName
6FROM
7    employees
8ORDER BY firstName, lastName    
9LIMIT 5;
similar questions
queries leading to this page
row number mysql