34,590
社区成员
发帖
与我相关
我的任务
分享
/*
DROP TABLE #IAccount
DROP TABLE #WebMaster
*/
CREATE TABLE #IAccount(city INT,username INT)
CREATE TABLE #WebMaster(city INT,username INT)
INSERT INTO #IAccount VALUES(1,1),(1,2)
INSERT INTO #WebMaster VALUES(1,1),(1,4)
SELECT * FROM #IAccount join #WebMaster
ON #IAccount.city=#WebMaster.city and #IAccount.username<>#WebMaster.username
-----------------------------------
city username city username
----- -------- ----- --------
1 2 1 1
1 1 1 4
1 2 1 4
-----------------------------------
结果是正确的,作用肯定是有的.
除非username 为 null 值,或者lz没明白自己想要说明数据吧.