當前位置:星座運勢大全官網 - 周易占卜 - 如何編寫復雜的SQL技術問答

如何編寫復雜的SQL技術問答

假設:table_user: user table (id,usename)table _ planet:planet table(userid,people)[php]//子查詢模式,不推薦且效率不高,選擇name,(SELECT sum(people)from table _ planet其中userid = table _ user.id)作為人數統計from table _ user//聯合查詢模式,選擇t1.username,sum (t2.people)作為人數統計推薦?內部連接table _ user AS t 1 ON T2 . userid = t 1 . id from table _ planet AS T2 group BY T2 . userid[/PHP]