1

I am trying to use a query that compares two column values, e.g.,

Select * from table where header1 = header2

but it does not seem to be working for me. Is this supported in CsvJdbc?

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418

1 Answers1

0

Yes, it does work. Confirmed with csvjdbc-1.0-28.jar. With the CSV file

id,header1,header2
1,1,1
2,1,2
3,2,1
4,2,2

and the Java code

public static void main(String[] args) {
    Properties props = new Properties();
    props.put("columnTypes", "INTEGER");
    try (
            Connection conn = DriverManager.getConnection("jdbc:relique:csv:C:/Users/Gord/Desktop", props);
            Statement s = conn.createStatement();
            ResultSet rs = s.executeQuery("SELECT id FROM table WHERE header1=header2")) {
        while (rs.next()) {
            System.out.println(rs.getInt(1));
        }
    } catch (Exception e) {
        e.printStackTrace(System.err);
    }

}

the result is

1
4
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418