@chips-a-hoai If the intention is to merge the contents of two existing csv files into a new csv file, this can be done without a SQL command altogether. Instead, because of the simple underlying formatting of a csv file, you can use VENUS to process a csv file as an ASCII file, where it will process the raw data, per the schema of the csv file. So instead of an excel formatted table, the data fields are processed as comma delimited strings.
Here is a snip of a very simple test method that would accomplish the general approach. This will handle csv files with varied numbers of columns, without needing to redefine the table schema contents, as per typical VENUS file open commands, which must match and expected schema of headers and contents.
You would just use any preferred means of populating the variables for the various file paths with actual desired paths.
Use the general file open commands under open mode ASCII for the two files you wish to read from and merge, and the new file you want to create. Use can use Append mode for all files.
Without additional preprocessing or data criteria, this approach would generally assume that you are merging tables of equal size (rows), so loop over one of the source files.
Once you have obtained your comma delimited data strings (read/write parameter from the file open command) by reading both of the source files, you can split the strings based on the comma delimiter into an array, where each element of the returned array would correspond to the data contained in the cell of the original csv. Note that this technique will force variable types for all data variable to string type, if they weren’t already. This function is found in the string library, which can be obtained by installing the HSLExtensions library linked by @EricSindelar_Hamilton in the VENUS libraries thread.
Once you have generated both arrays, you can merge them into a single array in the order of your choosing using the array concatenation function of the Array library. Again, this library will install when installing HSLExtensions.
Finally you can convert this array of merges data back to a comma delimited string, using the join with delimiter function present in the string library. Return this variable as the read/write variable of your new file.
Since we are processing as ASCII, use the HSLString library (a different string processing library that installs default with VENUS) to concatenate a “\n” to your write variable, before writing your merged data to your file. This will prompt a new line for the next write event (row).
This will yield a csv merged file. Hope this helps!