Difference between revisions of "ROWNUM()"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=ROWNUM=
+
''Note: The ROWNUM Pseudo Column has been replaced with the ROWNUM() function.''
 
+
 
+
==Class==
+
Pseudo Columns
+
  
  
 
==Purpose==
 
==Purpose==
Return a number indicating the order in which the rows are selected from the table
+
Function to return a number indicating the order in which the rows are selected from the table
  
  
 
==Syntax==
 
==Syntax==
ROWNUM
+
ROWNUM()
  
  
 
==See Also==
 
==See Also==
[[PSEUDO COLUMNS]], [[SQL INSERT|INSERT]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
+
[[CURSYNCNUM()]], [[PSEUDO COLUMNS]], [[RECNO()]], [[SQL INSERT|INSERT]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]], [[SYNCNUM()]]
  
  
 
==Description==
 
==Description==
A Pseudo Column behaves like a table column, but is not actually stored in the table. You can select from Pseudo Columns, but they cannot be updated.  Pseudo Columns provide extra information about a SELECT row set.
+
The ROWNUM() function returns a number indicating the order in which the rows are selected from the table.  This can be contrasted with the physical row number in the table.
 
+
The ROWNUM Pseudo Column will return a number indicating the order in which the rows are selected from the table.
+
  
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
// Display all overdue accounts with 15% commission in
+
OPEN DATABASE southwind
// Sorted "name" and "paid date" order with the row number.
+
SELECT rownum(), recno(), state from example where state = "MA"
EXEC SQL
+
SELECT ROWNUM, name, address, balance, cost*1.15
+
FROM accounts
+
WHERE paid_date < date()
+
ORDER BY name, paid_date;
+
 
</code>
 
</code>
  
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL]]
 
[[Category:SQL]]
[[Category:Pseudo Columns]]
+
[[Category:Functions]]

Latest revision as of 11:07, 5 July 2011

Note: The ROWNUM Pseudo Column has been replaced with the ROWNUM() function.


Purpose

Function to return a number indicating the order in which the rows are selected from the table


Syntax

ROWNUM()


See Also

CURSYNCNUM(), PSEUDO COLUMNS, RECNO(), INSERT, SELECT, UPDATE, SYNCNUM()


Description

The ROWNUM() function returns a number indicating the order in which the rows are selected from the table. This can be contrasted with the physical row number in the table.


Example

OPEN DATABASE southwind
SELECT rownum(), recno(), state from example where state = "MA"


Products

Recital, Recital Server