Skip to content

find函数报错 #216

@wakk3107

Description

@wakk3107

GORM Playground Link

go-gorm/playground#1

Description

	var records []*ActivationGeneration

	if err := conn.Table(repo.GetTableName(tenantID)).Where("tenant_id = ? AND date(create_time) = ?", tenantID, dateStr).Find(&records).Error; err != nil {
		return nil, err
	}

执行代码报这个错

SQL: 2025/05/16 09:54:21 activation_generation.go:64 code: 62, message: Syntax error: failed at position 63 ('?'): ? AND da
te(create_time) = ? VALUES. Expected one of: CAST operator, ANY, ALL, NOT, INTERVAL, CASE, DATE, TIMESTAMP, tuple, collection of literals, array, number, literal, NULL, 
Bool, true, false, string literal, asterisk, qualified asterisk, compound identifier, list of elements, identifier, COLUMNS matcher, COLUMNS, qualified COLUMNS matcher, 
substitution, MySQL-style global variable
[72.502ms] [rows:0] SELECT * FROM `t_activation_generation_ybx` WHERE tenant_id = 'ybx' AND date(create_time) = '2025-05-12'

这是为什么呀

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions