cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the same column value in multiple rows from sql anywhere database.?

Former Member
0 Kudos
1,260

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

Vlad
Product and Topic Expert
Product and Topic Expert
0 Kudos

I didn't understand the question, probably you were typing from your handy. But you should look at sa_rowgenerator.

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor
0 Kudos

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>
Former Member
0 Kudos

many thanks Volker barth, it works exactly what I want

Answers (0)