Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这很难解释,但我正在寻找用 IF EXISTS 替换它以提高性能:
Select ... , IF((SELECT COUNT( t.tab_id ) FROM tabs t WHERE t.marker_id = m.marker_id)>0,1,0) multimedia, .... FROM markers m WHERE ....
在此查询中,我希望有一个名为“多媒体”的临时列,如果有多媒体,则填充 1,如果没有,则填充 0。
此代码由 PHP 执行...
SELECT CASE WHEN Exists(Select 1 FROM tabs t WHERE t.marker_id = m.marker_id) THEN 1 ELSE 0 END multimedia, ...