The TOP clause is used to specify the number of records to return.
Syntax
SELECT TOP number column_name(s)
FROM table_name
Example :1
Select Top 2 custcode, custname from custmast
Example :2
Select Top 3 * from custmast
Syntax
SELECT TOP number column_name(s)
FROM table_name
custcode
|
custname
|
city
|
qty
|
rate
|
1
|
Siva
|
Srivilliputtur
|
50
|
70
|
2
|
Bala
|
Sivakasi
|
30
|
56
|
3
|
Kanna
|
Madurai
|
100
|
200
|
4
|
Vijay
|
Chennai
|
30
|
30
|
5
|
Kodee
|
Sandnes
|
60
|
80
|
5
|
Kodee
|
Srivilliputtur
|
60
|
30
|
Example :1
Select Top 2 custcode, custname from custmast
custcode
|
custname
|
1
|
Siva
|
2
|
Bala
|
Example :2
Select Top 3 * from custmast
custcode
|
custname
|
city
|
qty
|
rate
|
1
|
Siva
|
Srivilliputtur
|
50
|
70
|
2
|
Bala
|
Sivakasi
|
30
|
56
|
3
|
Kanna
|
Madurai
|
100
|
200
|
No comments:
Post a Comment