DB query improve: if one table has no column, the DB query should run precisely