Answers for "how to count the rows returned by a query context go"

Go
0

how to count the rows returned by a query context go

var count int

err := db.QueryRow("SELECT COUNT(*) FROM main_table").Scan(&count)
switch {    
case err != nil:
    log.Fatal(err)
default:
    fmt.Printf("Number of rows are %s\n", count)
}
Posted by: Guest on April-17-2020

Code answers related to "how to count the rows returned by a query context go"

Browse Popular Code Answers by Language