GORM计数返回0

Problem Statement

Problem 1

I am getting a 0 when trying to retrieve the count. The query expression is perfect, by which I assume that the query being built is correct.

However, the result is 0 irrespective of the query.

Problem 2

I am required to specify the db name in the Table clause as Table(dbname.tbname)

This isn't required in the any other queries and is required only when using Count()

What might I be missing?

package main

import (
    "github.com/jinzhu/gorm"
    _ "github.com/jinzhu/gorm/dialects/mssql"
    _ "github.com/jinzhu/gorm/dialects/mysql"
    _ "github.com/jinzhu/gorm/dialects/postgres"
    _ "github.com/jinzhu/gorm/dialects/sqlite"
)

var db *gorm.DB
var err error


func main() {

  db, err = gorm.Open("mysql",  "gorm:gorm@tcp(localhost:9910)/gorm?charset=utf8&parseTime=True")

 if err != nil {
         panic(err)
    }

    db.LogMode(true)

      var count int
      var  db = "db"
      var  tb  = "tb"
      var columnname = "somecol"
      var date = "2014-01-02"

      err := db.Table(db+"."+tb).Where("? >= ?", columnname, date+" 00:01:00").Count(&count)

        if err != nil {
                Error.Println(err.Error.Error())
       }
         fmt.Println("The Count is 
", count)

}

Update 1

The following works.

But this is as per my understanding using the result as *sql.Row and then retrieving the result using scan.

But I don't understand,why ...Count(&count) is giving a run time error?