jasmin
jasmin

Reputation: 21

How to parse values from database

    EMAIL                EML_GRP   
  -------                 -----      

[email protected]            1,2,3

[email protected]              1,4,5

This is the table structure. How do I parse the values in the EML_GRP field? I am using mySQL.

Upvotes: 0

Views: 73

Answers (2)

Andreas Dolk
Andreas Dolk

Reputation: 114757

Assuming (1) you use Java language and (2) you already submitted a query and read the values from a ResultSet, then you might have two Strings per record

String email = "[email protected]";  // just to demonstrate
String eml_grp = "1,2,3";

To get the numbers out of eml_grp, you can use the String.split method:

String[] numbers = eml_grp.split(",");

Upvotes: 0

Related Questions