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

asked 09 Oct, 07:26

ghkumarchd's gravatar image

ghkumarchd
3015
accept rate: 0%

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

(09 Oct, 07:52) Vlad

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>
permanent link

answered 09 Oct, 07:50

Volker%20Barth's gravatar image

Volker Barth
32.3k328474689
accept rate: 32%

edited 09 Oct, 07:52

many thanks Volker barth, it works exactly what I want

(11 Oct, 02:47) ghkumarchd
Comment Text Removed
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×33

question asked: 09 Oct, 07:26

question was seen: 55 times

last updated: 11 Oct, 02:59