
select count(*) from MeterSessionInput
left join Meter on MeterSessionInput.MeterKey = Meter.MeterKey
left join Customer on Meter.CustomerKey = Customer.CustomerKey
where MeterSessionInput.MeterSessionInputKey
not in
(select MetersessionInputKey from MeterSessionOutput)


select 
substring(AccountNumber,1, 11) as AccountNo,
Meter.MeterNumber,
FullStreetAddress,
FullName,
Meter.UtilityMeterSequenceNumber,
case  Meter.MeterCategory
when 4 then 'Water'
when 1 then 'Gas'
end as 'MeterType',
MeterSessionInputRF.EndpointID as EndpointID, 
MeterSessionInput.PreviousRead
from MeterSessionInput
left join Meter on MeterSessionInput.MeterKey = Meter.MeterKey
left join Customer on Meter.CustomerKey = Customer.CustomerKey
left join MeterSessionInputRF on MeterSessionInput.MeterSessionInputKey  = MeterSessionInputRF.MeterSessionInputKey 
where MeterSessionInput.MeterSessionInputKey
not in
(select MetersessionInputKey from MeterSessionOutput)
order by
Meter.UtilityMeterSequenceNumber



