Use the following code to insert DISTINCT keyword into a query:
SQLSubQuerySelectExpression selexpr = queryBuilder1.ActiveSubQuery.ActiveUnionSubquery.QueryAST;
selexpr.SelectMode = new SQLSubQuerySelectModeDistinct(queryBuilder1.SQLContext);
queryBuilder1.ActiveSubQuery.ActiveUnionSubquery.NotifySQLUpdated();

Is this article helpful for you?