这是我想要获取嵌套查询的表结构 它应该是
function repeat(operation, num) {
if (num <= 0)
return;
operation();
return repeat(operation, --num);
};
答案 0 :(得分:1)
使用join,并添加到where子句以确保每次只能获得一对(通过确保a小于b-使用&lt;&gt;仍然会给你2-3和3-2 in结果)
SELECT A.no, B.no
FROM table1 as A INNER JOIN table1 as B
ON A.city = B.city
WHERE A.no < B.no;
答案 1 :(得分:0)
此案例需要自我加入。 如下所示的查询将为您提供所需的结果:
SELECT a.no, b.no
FROM table_1 as a JOIN table_1 as b
ON a.city = b.city
WHERE a.no <> b.no;
table_1
是问题中提到的表格。