Ask Your Question

need display sl no in control table

asked 2018-01-05 19:08:34 +0200

koolninja gravatar image

updated 2018-01-06 08:57:06 +0200

backhand HSQLDB 2.4 and LibreOffice 5.4.4 with 64 bit

Auto increment primary key sequence number generated in table but during filter with sql query proper sequence slno can't be displayed in control table view. So what is trick to generate slno sequence 1,2,3, on along with filtered data from database table

This SlNo column of control table of form have not relation with any table. it treated as independent. when data displayed in control table through any query then row numbered in sequence at SlNo column. As filtered data ordered by two or parameter then sequence of SlNo column can't be extracted from table....

edit retag flag offensive close merge delete


What is your engine? For example, Oracle DB has a ROWNUM pseudocolumn.

Jim K gravatar imageJim K ( 2018-01-05 22:21:28 +0200 )edit

Based upon the last few SQL questions, this may not be possible. The manner in which the query result is constructed may have no specific "slno" associated with it. Most of past statements deal with 'Select Distinct..' in them. This means the result is not based upon one specific record.

Ratslinger gravatar imageRatslinger ( 2018-01-06 01:54:23 +0200 )edit

@koolninja You state one type of query displays 'SlNo' but another (filtered) doesn't. Could you provide sample of each?

Ratslinger gravatar imageRatslinger ( 2018-01-06 15:19:52 +0200 )edit

Please provide a reproducible example. See guidelines for asking.

Jim K gravatar imageJim K ( 2018-01-08 21:17:18 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-01-08 21:13:14 +0200

Jim K gravatar image

For example, create Table1 as follows.

1         a     aa
2         b     bb
3         a     aa
4         b     cc
5         c     cc
6         a     dd

Now use this query. When asked, enter a for the filter parameter.

FROM "PUBLIC"."PUBLIC"."Table1" AS "Table1"
WHERE "VAL1" = :param

The result shows sequential numbers 1, 2, 3 for the first column.

rownum 1 2 3

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-01-05 19:08:34 +0200

Seen: 46 times

Last updated: Jan 08 '18