1.在线格式化工具:
https://www.qianbo.com.cn/Tool/Beautify/Sql-Formatter.html
-
格式化后用@拼接
string sql = @"
SELECT
rack.rackRow,
rack.rackColumn,
rack.rackLayer
FROM
rack
LEFT JOIN TaskList
ON rack.rackColumn = TaskList.Unload_Col
AND rack.rackRow = TaskList.Unload_Line
AND rack.rackLayer = TaskList.Unload_Layer
LEFT JOIN TaskList0
ON rack.rackColumn = TaskList0.Unload_Col
AND rack.rackRow = TaskList0.Unload_Line
AND rack.rackLayer = TaskList0.Unload_Layer
WHERE
rack.used = 0
AND (
(
TaskList.Unload_Col IS NULL
AND TaskList.Unload_Line IS NULL
AND TaskList.Unload_Layer IS NULL
)
OR (TaskList.Excute = 1)
)
AND (
TaskList0.Unload_Col IS NULL
AND TaskList0.Unload_Line IS NULL
AND TaskList0.Unload_Layer IS NULL
)
ORDER BY
rack.rackRow,
rack.rackLayer
LIMIT 1;