Jes Sie

Jes Sie

  • 735
  • 1.2k
  • 284.2k

Return Specific Value from a table

Nov 3 2023 3:03 AM

Hello DBA's. I have a query that selects all the insured policies from the previous year, as shown below:

select	MotorCINo, 
		IssuanceType, 
		VehicleType, 
		VehiclePower, 
		VehicleChasisNo, 
		InsuranceType, 
		InsuranceOption, 
		PeriodFrom, 
		PeriodTo 
from tblMotorInsurance_eCI 
where YEAR(PeriodFrom) = YEAR(DATEADD(year,-1,GETDATE())) and PeriodTo < CAST(getdate() as date) and IssuanceType <> 'Short Term'
order by PeriodFrom desc

 

The output is also shown below:

How do I get the list of motor vehicles that did not renew the policy this year? Thank you in advance.


Answers (3)