子查询的最佳实践写法是什么? #1508

Closed
opened 2020-01-13 03:56:34 +00:00 by voidint · 3 comments
  • 查到的资料中发现之前xorm支持Where().QueryExpr()方式构建子查询,但是最新的版本中好像已经找不到QueryExpr这个方法。
  • 构建子查询SQL的方式的确有很多,比如原生SQL或者各种SQL builder,请问针对xorm的子查询最佳实践写法是怎么样?
- 查到的资料中发现之前xorm支持`Where().QueryExpr()`方式构建子查询,但是最新的版本中好像已经找不到`QueryExpr`这个方法。 - 构建子查询SQL的方式的确有很多,比如原生SQL或者各种SQL builder,请问针对xorm的子查询最佳实践写法是怎么样?
Contributor

QueryExpr 应该是 xormplus 里的

QueryExpr 应该是 xormplus 里的
Author

的确是我看错了,QueryExpr是xormplus的方法。

的确是我看错了,`QueryExpr`是xormplus的方法。
Owner

I recommand you use xorm/builder. i.e.

engine.Where(builder.Eq{
	"a": builder.Select("id").From("table2"),
    }).Find()
I recommand you use `xorm/builder`. i.e. ```go engine.Where(builder.Eq{ "a": builder.Select("id").From("table2"), }).Find() ```
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1508
No description provided.