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.
我想编写一个选择存储过程,并且在 where 子句中我想检查我正在执行选择查询的当前表的父表的字段的值,我怎样才能做到这一点?任何帮助将不胜感激
你会喜欢JOIN那些桌子。在不知道表定义的情况下,您的查询应该如下所示:
JOIN
SELECT C.* --- List the columns you want here FROM ChildTable C INNER JOIN ParentTable P ON C.ParentID = P.ID --- something along this lines WHERE P.SomeField = 1 --- put here your condition on the parent table