Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. INSERT INTO C (MeterId,PresRecTimestamp,PresUnits,PresVal)
  2. SELECT DISTINCT
  3. A.FlowMeter,
  4. B.RecordTime,
  5. substring(B.FormattedValue, CHARINDEX(' ',B.FormattedValue)+1, LEN(B.FormattedValue)),
  6. substring(B.FormattedValue, 1, CHARINDEX(' ',B.FormattedValue)-1)
  7. FROM B
  8. INNER JOIN A ON A.Id = B.Id
  9. WHERE
  10. NOT EXISTS (SELECT * FROM C WHERE
  11. C.MeterId = A.FlowMeter AND
  12. C.PresRecTimestamp = B.RecordTime)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement