SELECT I.uname, C.consume, O.name,O.dis_count,O.memberType, D.name,D.dis_count,D.up,D.down, CASE WHEN D.dis_count IS NULL THEN O.dis_count ELSE D.dis_count END AS discount FROM ( sdb_membermanage_members AS I LEFT JOIN sdb_membermanage_moneyanddiscou…