Search code examples
javajdbcopencsv

Adding 2 columns before the other columns in a csv file


I need to generate a csv file containing the ResultSet taken from database, from my java app. I have used the opencsv library. I am using a method "writeAll(ResultSet set,boolean flag)" and everything is fine. The ResultSet is written in the csv file. But now I have to add another 2 columns before the others.
These columns are not in the database. One of this columns will take the value of a database column and the other will contain static value.
Can someone tell me what to do please?


Solution

  • SELECT a,b,c,d,a as e,'something' as f FROM mytable