03-09-2017 03:13 AM
I have an interesting challenge to repeat same rows multiple times in a result.
As an example, I have a table with 3 records.
---------------------------------
| id | Product | Description | Qty |
---------------------------------
| 1 | P1 | Product 1 | 2 |
| 2 | P2 | Product 2 | 3 |
| 3 | P3 | Product 3 | 1 |
---------------------------------
The result set should look like below with 5 rows
---------------------------------
| id | Product | Description | Qty |
---------------------------------
| 1 | P1 | Product 1 | 2 |
| 2 | P2 | Product 2 | 3 |
| 1 | P1 | Product 1 | 2 |
| 3 | P3 | Product 3 | 1 |
| 2 | P2 | Product 2 | 3 |
---------------------------------
I have tried with UNION ALL, IN Functionalities but missing something in a query.
Solved! Go to Solution.
03-09-2017 03:23 AM
Hi AB,
The result set should look like below with 5 rows
Index the rows as needed in a loop and use the autoindexed loop output…
I have tried with UNION ALL, IN Functionalities but missing something in a query.
Are you talking about LabVIEW here at all?
Could you attach your VI?
03-10-2017 06:45 AM - edited 03-10-2017 06:45 AM
Index the rows as needed in a loop and use the auto indexed loop output…
Indexing will increase time to extract data base
I am taking about SQL query (UNION ALL,IN)used to extract data from database
03-10-2017 06:52 AM - edited 03-10-2017 06:53 AM
Hi AB,
maybe you should give a FULL view of your task!
So you query some "rows" (aka records) from a database. Then you want to output those "rows" somewhere in a certain order with some of the "rows" duplicated in a "random" scheme.
Atleast that's what I read from your description so far…
Where do you read from?
How do you read the "rows"?
How do you want to (re)order the rows?
Where do you want to store those "rows"?
03-12-2017 11:33 PM
Your understanding is correct!
Where do you read from?
Table column
How do you read the "rows"?
Based column1
How do you want to (re)order the rows?
based on input array framed
Where do you want to store those "rows"?
storing not required, need to read in text
Similar to question posted..
03-13-2017 12:37 AM
03-13-2017 01:03 AM
Like udka seems to be saying, I'd also suggest getting the simplest data into LabVIEW, and then doing more complicated operations natively in LabVIEW. Although you can write obscenely clever queries (perhaps - I can't!...) in SQL, in many cases LabVIEW is more able to handle what you need (and at least for me, often in a simpler to understand (and more importantly code) way).
I have found in the past I can read multiple orders of magnitude more data out of a database and decimate it in LabVIEW than try and concoct an indexing function within the database to decimate there in the same time.
Once you know the way in which you want to duplicate data, getting LabVIEW to do it (with Insert Into Array as udka suggests, or similar) should be simple.
03-16-2017 03:06 AM
All ready I have implemented by Indexing..
I would like to know any other solution is available.
03-31-2017 05:44 AM
I have got solution by using where and IN keywords in combination