0
SQL新手在這裏。在多個表中選擇同一列的差異sql
我有這樣的模式:
我需要用簡單的英語是什麼:
「出了2列,使一個在另一個的上面一個欄,再算上多少distincts值有」
我已經試過
SELECT COUNT (DISTINCT uid) from nodes UNION SELECT COUNT (DISTINCT uid) from ways ;
SELECT distinct nodes.uid from nodes JOIN ways on nodes.uid = ways.uid ;
sqlite> SELECT COUNT (DISTINCT uid) from nodes UNION SELECT COUNT (DISTINCT uid) from ways ;
1195
2182
sqlite> SELECT uid from nodes FULL OUTER JOIN ways on nodes.uid = ways.iud ;
Error: RIGHT and FULL OUTER JOINs are not currently supported
SELECT COUNT (DISTINCT iud) FROM (SELECT DISTINCT uid from nodes as uid UNION SELECT DISTINCT uid from ways as uid as subq);
SELECT count (distinct nodes.uid) from nodes JOIN ways on nodes.uid = ways.uid ;
需要年齡和我不知道nodes.uid = ways.uid是去
任何想法的正確方法是什麼?