SQL exists( select 1 from
1 2 3 4 5 6 7 8 9 10 | use UnlockIndustry select * from Info_Coordinate as A join Info_Employee on A.EmployeeId=Info_Employee.EmployeeId Where exists( select 1 from ( select EmployeeId, MAX (CreateTime) as CreateTime from Info_Coordinate group by Info_Coordinate.EmployeeId ) as b where A.EmployeeId=b.EmployeeId and A.CreateTime=b.CreateTime) And Info_Employee.CompanyId= '1306010001' /* 关联人员和地址表。 select * from info_A as A JOIN Info_B ON A.id=Info_B.id where exists() and info_B.Cid='' */ |
例子:
______________________________________________________________________________
1 2 3 4 5 | use MyMvc select * from Info_Company select * from Info_Empoyee select * from Info_Empoyee left Join Info_Company on Info_Empoyee.CompanyID=Info_Company.CompanyID select * from Info_Empoyee where exists( select 1 from Info_Company where Info_Empoyee.CompanyId=Info_Company.CompanyID) |
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步