Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SELECT id FROM table1 WHERE name LIKE 'test%';
这将向我显示 table1 中的所有 id 以及任何与 test% 匹配的 id。所以我一直在这样做:
SELECT * FROM table2 WHERE id = '1011';
无论如何让我的 table1 查询跳转并自动插入到 WHERE id = '1011',我希望它自动匹配查询一中的内容以查询二。不必一遍又一遍地运行第二个查询并更快地获得所有结果。
你想做一个JOIN:
SELECT a.* FROM table2 a JOIN table1 b ON a.id = b.id WHERE b.name LIKE 'test%'