Tech Tip: How to access "record numbers" in a SQL query?
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: January 6, 2012
To access "record numbers" in a SQL query, the __ROW_ID virtual field can be used. For example:
Begin SQL SELECT Field_1 FROM Table_1 WHERE __ROW_ID = 5 INTO :$test_t; End SQL |
Keep in mind that this behaves nothing like DB4D code. There is no "current record" in SQL, for example, so no record pointer is being moved like would happen with GOTO RECORD. Also the virtual fields are mainly for 4D internal use and are thus subject to change in implementation. It is preferable to use the primary key to locate the record via SQL.