disable derived_merge in a query where it may cause the wrong result, instead of using DISTINCT trick.
Attach a file by drag & drop or click to upload