多条数据更新,
UPDATE 不支持 别名, INSERT 支持别名
UPDATE user SET
age = CASE id
WHEN 1 THEN '16'
WHEN 2 THEN '15'
END,
name = CASE id
WHEN 1 THEN 'tom'
WHEN 2 THEN 'jim'
END
WHERE id IN (1,2) AND id1 IN (11,22)
联合查询
SELECT
B.* from T_DB_EXPRESS_APP_ORDER as A
LEFT OUTER JOIN
T_DB_EXPRESS_APP as B
on
A.userid = B.userid
AND A.appId = B.appId
WHERE A.userid = '099921'
AND (B.type = '1' OR B.type = '2')