以下是我的查询:

def getdata1 = sql.rows("select student_id,school_grade_class_id from class_assign")

如何从student_id获取getdata1

更新:
def getdata1 = sql.rows("select student_id,school_grade_class_id from class_assign")


def getdata2 = sql.rows("select class_id,class_name,school_grade_id from class_rel where school_grade_class_id=**x**")

我应该从alue of school_grade_class_id将x替换为resultset v getdata1
我该怎么办?

最佳答案

您可以执行以下操作:

getdata1.each{
    println it.student_id
}

要么
sql.eachRow("select student_id,school_grade_class_id from class_assign", {
   println it.student_id
})

10-05 18:28