我想查詢表在MySQL數據庫中值IN
片:如何使用sqlx在切片中查詢mysql?
var qids []int
//fill qids dynamically
err = database.SQL.Select("es,
"SELECT * FROM quote WHERE qid IN $1", qids)
if err != nil {
log.Println(err)
}
但我得到這個錯誤:
sql: converting Exec argument #0's type: unsupported type []int, a slice
quotes []
我怎樣才能解決這個問題?
可能重複[Go和IN子句在P ostgres](http://stackoverflow.com/questions/38036752/go-and-in-clause-in-postgres);和[Golang MySQL使用IN運算符查詢未定義的args數量](http://stackoverflow.com/questions/39223856/golang-mysql-querying-undefined-amount-of-args-using-in-operator)。 – icza
@icza我不這麼認爲。這個功能只能在'sqlx'中使用。 – TheHippo