on 2018 Oct 09 8:26 AM
hai experts
i have a table called product in sql anywhere database which have a column of barcode-id of datatype varchar(15) and have the following values ie, 8 rows barcode_id UT10000 UT10001 UT10002 UT10003 UT10004 UT10005 UT10006 UT10007 when run a sql query like below Select barcode_id from product where barcode_id=:UT10001 and no of rows=:4 I want to get following values barcode_id UT10001 UT10001 UT10001 UT10001 ie, 4 rows if no.of rows = 10 then 10 rows of same barcode_id should be viewed How to achieve this through sql in sql anywhere database? regards kumar
You can use the sa_rowgenerator() system procedure to generate a specified number of rows and then do a CROSS JOIN with your desired result set, such as:
select P.barcode_id from product P cross join sa_rowgenerator(1, <parameter2>) where P.barcode_id = <parameter1>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.