diff --git a/lex/lexer.go b/lex/lexer.go
index <HASH>..<HASH> 100644
--- a/lex/lexer.go
+++ b/lex/lexer.go
@@ -1528,8 +1528,8 @@ func LexSelectClause(l *Lexer) StateFn {
 			l.Emit(TokenAll)
 		}
 	case "di": //Distinct?
-		word := strings.ToLower(l.PeekX(len("DISTINCT")))
-		if word == "distinct" {
+		word := strings.ToLower(l.PeekX(len("DISTINCT ")))
+		if word == "distinct " || word == "distinct\n" {
 			l.ConsumeWord(word)
 			l.Emit(TokenDistinct)
 		} // DISTINCTROW?
Ensure distinct in sql select is a standalone word