You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to run this sql command, the query uses the limit and offser but bypass the orderBy.
In the other hand, If I wrote the query manually (SELECT * FROM partner ORDER BY id DESC) works perfectly
// The inputs I recive are of this type orderBy string, limit, offset int64
query := "SELECT * FROM partner ORDER BY ? LIMIT ? OFFSET ?"
stmt, err := db.Prepare(query)
if err != nil {
return
}
defer stmt.Close()
rows, err := stmt.Query(orderBy, limit, offset)
The text was updated successfully, but these errors were encountered:
This isn't related to this driver, Go, or database/sql. I suggest trying to run those queries from the terminal directly. As far as I recall, the LIMIT and OFFSET parameters cannot be parameters, they must be literals that are inserted directly into the query.
But I think placeholders my not be used as an aggregate (GROUP BY) function parameter. I can not find a statement on this in the MySQL docs, but it would make a lot of sense when taking into account how aggregate functions are usually implemented.
I tried to run this sql command, the query uses the limit and offser but bypass the orderBy.
In the other hand, If I wrote the query manually (SELECT * FROM partner ORDER BY id DESC) works perfectly
The text was updated successfully, but these errors were encountered: