條款我有一個表的追蹤者和追蹤數選擇查詢..兩次與不同的地方在同一個表
想利用這兩者的數量在一個存儲過程..是有可能有不同的兩個選擇查詢在同一張桌子上的條件可能?
CREATE TABLE Table1
([val1] int, [val2] int, [val3] int, [val4] int, other int)
;
INSERT INTO Table1
([val1], [val2], [val3], [val4], other)
VALUES
(1, 26, 13, 1, 1),
(2, 13, 26, 1, 1),
(3, 10, 26, 1, 1),
(4, 26, 13, 1, 1),
(5, 14, 26, 1, 1)
;
我的選擇查詢
(select count(*) as following_count from table1 where val2=26)
(select count(*) as follower_count from table1 where val3=26)
我認爲這會爲我工作 – 2014-10-07 06:30:39