I'm trying to run the following query using gorp library with mysql
query = "SELECT SUM(outputoctets) FROM monthlyacct where date >= ? AND date < ? AND location = ?"
count, err := dbMap.SelectInt(query , constrains.From, constrains.To, constrains.LocationId)
This query throws the following error,
Scan error on column index 0: converting string \"\u003cnil\u003e\" to a int64: strconv.ParseInt: parsing \"\u003cnil\u003e\": invalid syntax
Here column outputoctets is type BIGINT. I also tried changing SelectInt to SelectStr, then it threw the following error;
Scan error on column index 0: unsupported driver -\u003e Scan pair: \u003cnil\u003e -\u003e *string
When I ran the query without location filter, it worked. Seems like this is due to some NULL values present in the location column. However I need to have the location filter on the query. How can I solve this?