2

How to select a specific column in a table?

This returns a row..

public static Model getData(String userId) { return new Select().from(Model.class).where("userId=?", userId).executeSingle(); }

Replacing it as : return new select("coloumnName").from(Model.class).where("userId=?", userId).executeSingle(); didnt work.

1 Answers1

0

Provide a String[] to Select.

So you would do something like this:

new Select( new String[]{ "columnName" } )
      .from( Model.class )
      .where( "userId = ?", userId )
      .executeSingle()
Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245