I’m building a SQL with UNION, and following the practice from other posts, I’m concatenating strings like this:
var unionSql = q1.ToMergedParamsSelectStatement()
+ " UNION " + q2.ToMergedParamsSelectStatement();
I’d like for the individual q1, q2 to have DISTINCT on them, so the resulting SQL would be something like
select distinct q1.* union distinct q2.*
Before you suggest a single distinct on the whole statement, I must say that the my actual query is more complicated than in my example, with sub selects and such, so I need the DISTINCT on each query (for reasons I can explain if necessary).
q1.SelectDistinct().ToMergedParamsSelectStatement()
doesn’t do anything.
Could you provide a ToMergedParamsSelectDistinctStatement()
?