0
我正在使用MariaDB。我試圖從SELECT不同的表中更新兩列。如何從MariaDB的不同表中更新多列
UPDATE User U
SET
U.UserPoint = (
SELECT ((SELECT COUNT(*)
FROM CARD_COMM R
WHERE R.Card_ID = C.Card_ID) * 3
+
(SELECT COUNT(*)
FROM SECTION_CARD_LIKE L
WHERE L.Card_ID = C.Card_ID) * 1) as userPoint
FROM CARD C WHERE C.userid = U.userid ORDER BY userPoint DESC limit 1)
這個作品
UPDATE User U
SET
(U.UserPoint, U.Card) = (
SELECT ((SELECT COUNT(*)
FROM CARD_COMM R
WHERE R.Card_ID = C.Card_ID) * 3
+
(SELECT COUNT(*)
FROM SECTION_CARD_LIKE L
WHERE L.Card_ID = C.Card_ID) * 1) as userPoint,
C.Card_ID as card
FROM CARD C WHERE C.userid = U.userid ORDER BY userPoint DESC limit 1)
但這個劑量不....
如何做到這一點? 請幫我...
不確定你想要做什麼?在第一個示例中,您在一列中插入單個值。在第二個示例中,您嘗試相同,但指定兩列但只有一個值? –