Числовые данные с плавающей точкой.
'city' => [self::HAS_ONE, 'City', ['id'=>'city_id']]
['id'=>'city_id']
, возможно надо наоборот, не помню.turnOnSpinner();
somePromise().then((data) => {
turnOffSpinner();
// processData
});
SELECT
sour.source,
COUNT(app.sour_id) as `c`
FROM `app`
RIGHT JOIN `sour` ON sour.id = app.sour_id
GROUP BY(app.sour_id)
HAVING COUNT(app.sour_id) > 2
HAVING c > 2
CREATE SCHEMA test
DEFAULT CHARACTER SET utf8
DEFAULT COLLATE utf8_unicode_ci;
USE test;
create table test (
id INT PRIMARY KEY AUTO_INCREMENT,
`data` VARCHAR(256)
) CHARACTER SET utf8;
select * from test.test
package main
import (
"fmt"
"net/http"
"database/sql"
_ "github.com/go-sql-driver/mysql"
"encoding/json"
)
func main() {
var db *sql.DB
var err error
var stmt *sql.Stmt
var res sql.Result
var str = struct {
Hello string `json:"hello"`
}{"world"}
var data, _ = json.Marshal(str)
if db, err = sql.Open("mysql", "root:root@/test"); err != nil {
panic(err)
}
if stmt, err = db.Prepare("INSERT INTO test (data) VALUES (?)"); err != nil {
panic(err)
}
if res, err = stmt.Exec(data); err != nil {
panic(err)
}
fmt.Printf("%v", res)
}