请问一个SQL查询功能语句怎么写.

2025-01-01 13:39:40
推荐回答(1个)
回答1:

SELECT
F1,
F2,
F3,
F4
FROM
Table1
WHERE
F1 = CASE WHEN P1 = 0 THEN F1 ELSE P1 END
AND F2 = CASE WHEN P2 = 0 THEN F2 ELSE P2 END
AND F3 = CASE WHEN P3 = 0 THEN F3 ELSE P3 END
AND F4 = CASE WHEN P4 = 0 THEN F4 ELSE P4 END