Dhaka To

Mysql Query for Generate Serial Number in SELECT Statement

Mysql Query for Generate Serial Number

Simple way to make it happen.

Follow this example:

Table Name : purchase
Fields : party, amount, purchase_id (primary key)
Query :
“select party ,amount ,ROW_NUMBER() OVER (order by purchase_id)as serial from purchase”
“select *,ROW_NUMBER() OVER (order by purchase_id) as serial from purchase”
(Note : For both the Queries you will get the same output as below)
party amount serial
sam 25000 1
John 30000 2

Try this. I hope it will help you.

Read Previous

Two and a half thousand stars in the supermoon

Read Next

FPDF Problem Variable in Header or Footer Function Scoping Problem

Leave a Reply

Your email address will not be published. Required fields are marked *