SELECT 命令其實(shí)很簡(jiǎn)單,也很常用,但代碼閱讀經(jīng)常為coder造成困擾,其實(shí)用一種標(biāo)準(zhǔn)格式書(shū)寫(xiě)可以減低困擾的強(qiáng)度。
SELECT
field1,
field2,
...
FROM table1 a
JOIN table2 b on 1=1
AND join_condition1
AND join_condition2
..
WHERE 1=1
AND filter_condition1
AND filter_condition1
AND (1=2
or filter_condition_sub1
or filter_condition_sub2
)
更多信息請(qǐng)查看IT技術(shù)專欄