复杂查询

SELECT age, code, (SELECT UserName FROM tFrsUser t WHERE t.UserCode = QueryTest.code) AS name FROM QueryTest WHERE 1 = 1 AND Exists (SELECT UserName FROM tFrsUser t WHERE t.UserCode = QueryTest.code AND UserName Like '%李文%') AND EXISTS (Select 1 From QueryTestDetail QueryTestDetail Where QueryTest.code = QueryTestDetail.code and Exists (SELECT ModuleName FROM tFrmModule t WHERE t.ModuleCode = QueryTestDetail.depcode and t.ModuleCode like 'S%' and ModuleName Like '%库存%'))

    推荐阅读