SELECT 命令其实很简单,也很常用,但代码阅读经常为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技术专栏