仅从案例类中获取遵循该条件的那些值

时间:2014-03-02 07:14:23

标签: mysql scala playframework-2.0

def getAll(userid:BigInteger) = {
    DB.withConnection { implicit Connection =>
      val dat = SQL("select * from id_info_user where user_id=" + userid)
      var data = dat().map(row =>
       RecordAll(row[Int]("country"),row[Int]("age"),row[Int]("gender"),row[Int]  ("school"),row[Int]("college"),row[Int]("specialization"),row[Int]("company"))).toList       
        data
    }

  }

数据库包含六列,只有零或一个值。 这给了我行值列表,但我只想要那些值为1的值。

0 个答案:

没有答案