查询最后续订许可证 [英] query last Renewal of licences

查看:83
本文介绍了查询最后续订许可证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我每年都有一个续订许可证的客户。如何查询客户每个部分更新许可证的最后一年...我尝试了这个代码,但突然它只产生了2014年的最大年份,尽管有些客户自2012年以来没有续签他们的许可证。 ..



  SELECT   @last_expired_date  = MAX(expired_license_date)
FROM corporateur RIGHT OUTER JOIN Firm_info ON entrepreneur.entre_ID = Firm_info.entre_ID RIGHT JOIN 部分 ON Firm_info.Section_ID = Section.Section_id
RIGHT JOIN license ON Firm_info.firm_no = lic ense.firm_no RIGHT JOIN license_operations ON 许可证.license_serial = license_operations.license_serial
WHERE Section.Section_id = @ section_no
< span class =code-keyword> GROUP BY license.license_serial

解决方案

解决方法: http://stackoverflow.com/questions/22303151/query -last-renewal-of-licenses [ ^ ]

Suppose I have a Client with Renewal of licences every year. How do I query to get the last year that the clients had renew their licences per section... i tried this code but suddenly it just produce the max year in the section i.e 2014 though there some clients have no renewal their licences since 2012...

SELECT @last_expired_date = MAX(expired_license_date)
 FROM entrepreneur RIGHT OUTER JOIN Firm_info ON entrepreneur.entre_ID = Firm_info.entre_ID RIGHT JOIN Section ON Firm_info.Section_ID = Section.Section_id
   RIGHT JOIN license ON Firm_info.firm_no = license.firm_no RIGHT JOIN license_operations ON license.license_serial = license_operations.license_serial
 WHERE Section.Section_id = @section_no
  GROUP BY license.license_serial

解决方案

Solved here : http://stackoverflow.com/questions/22303151/query-last-renewal-of-licences[^]


这篇关于查询最后续订许可证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆