From 83002c4d5f060f4819bfd2115b76a0e1429a7f32 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Mon, 14 Mar 2016 08:05:36 +0800 Subject: [PATCH] Include default search attributes when query with Join, close #906 --- scope.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scope.go b/scope.go index 45e197c4..65a438cf 100644 --- a/scope.go +++ b/scope.go @@ -712,6 +712,9 @@ func (scope *Scope) whereSQL() (sql string) { func (scope *Scope) selectSQL() string { if len(scope.Search.selects) == 0 { + if len(scope.Search.joinConditions) > 0 { + return fmt.Sprintf("%v.*", scope.QuotedTableName()) + } return "*" } return scope.buildSelectQuery(scope.Search.selects)