SELECT 命令其實很簡單,也很常用,但代碼閱讀經(jīng)常為coder造成困擾,其實用一種標準格式書寫可以減低困擾的強度。
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
)
更多信息請查看IT技術專欄
2025國考·省考課程試聽報名