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
this not use
2023/08/08 15:06:09
[0.122ms] [rows:0] SELECT * FROM microloan.account_base WHERE (pizza = "pepperoni" AND (size = "small" OR size = "medium")) OR (pizza = "hawaiian" AND size = "xlarge")
this used
2023/08/08 15:06:09
[0.025ms] [rows:0] SELECT * FROM microloan.account_base WHERE ((pizza = "pepperoni" AND size = "small" OR size = "medium") AND pizza = "hawaiian" AND size = "xlarge")
I need to specify 'database.table' using 'table()', but I want the result of the first.
Or is there another way to specify a database?
The text was updated successfully, but these errors were encountered:
GORM Playground Link
#1
Description
gorm v2组查询时,使用.Table与不使用生成的sql不一样
This parameter is used to query the gorm v2 group. Table is not the same as sql generated without using it
`
db, _ := gorm.Open(sqlite.Open("gorm.db"), &gorm.Config{})
pizzas := struct {
}{}
db.Table("microloan.account_base").Where(
db.Where("pizza = ?", "pepperoni").Where(db.Where("size = ?", "small").Or("size = ?", "medium")),
).Or(
db.Where("pizza = ?", "hawaiian").Where("size = ?", "xlarge"),
).Find(&pizzas)
db = db.Table("microloan.account_base")
db.Where(
db.Where("pizza = ?", "pepperoni").Where(db.Where("size = ?", "small").Or("size = ?", "medium")),
).Or(
db.Where("pizza = ?", "hawaiian").Where("size = ?", "xlarge"),
).Find(&pizzas)
`
this not use
2023/08/08 15:06:09
[0.122ms] [rows:0] SELECT * FROM microloan.account_base WHERE (pizza = "pepperoni" AND (size = "small" OR size = "medium")) OR (pizza = "hawaiian" AND size = "xlarge")
this used
2023/08/08 15:06:09
[0.025ms] [rows:0] SELECT * FROM microloan.account_base WHERE ((pizza = "pepperoni" AND size = "small" OR size = "medium") AND pizza = "hawaiian" AND size = "xlarge")
I need to specify 'database.table' using 'table()', but I want the result of the first.
Or is there another way to specify a database?
The text was updated successfully, but these errors were encountered: