[mw_shl_code=sql,true]from trackinfo a
left outer join pm_info b
on (
case when (a.ext_field7 is not null
and length(a.ext_field7) > 0
and a.ext_field7 rlike '^[0-9]+$')
then
cast(a.ext_field7 as bigint)
else
cast(ceiling(rand() * -65535) as bigint)
end = b.id
)
为何不在关联之前将trackinfo表中的数据先过滤一下,然后在进行关联查询?不可以吗?
from (select * from trackinfo t where t.id is not null and nd length(a.ext_field7) > 0
and a.ext_field7 rlike '^[0-9]+$') as a
left out join pm_info b on a.id = b.id[/mw_shl_code]