Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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...

SQL
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
Posted
Comments
RAHUL(10217975) 10-Mar-14 10:36am    
Can you provide sample data

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900