Generate Serial Number with Output

>>Script Language and Platform: SQL Server
This script generates a serial number with output. Suppose table APP contains
different appointment types, and you want to genrate all distinct apptypes
with serial number, this query will generate that output.

Author: Vijay Dwivedi


select a.apptype,count(*) from
(select distinct apptype as apptype from APP where apptype is not null ) a,
(select distinct apptype as apptype from APP where apptype is not null ) b
where a.apptype>=b.apptype
group by a.apptype
order by a.apptype



Disclaimer:
We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…

Disclaimer Continued

Back to Database Journal Home

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles