Guest User

Untitled

a guest
Apr 26th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. {
  2. "ProductId": 1,
  3. "Status": true,
  4. "Code": "123456",
  5. "IsRecall": false,
  6. "ScanLog": [
  7. {
  8. "Location": {
  9. "type": "Point",
  10. "coordinates": [
  11. 13.5957758,
  12. 42.7111538
  13. ]
  14. },
  15. "TimeStamp": 201602160957190600,
  16. "ScanType": 0,
  17. "UserId": "1004"
  18. },
  19. {
  20. "Location": {
  21. "type": "Point",
  22. "coordinates": [
  23. 13.5957907,
  24. 42.7111359
  25. ]
  26. },
  27. "TimeStamp": 201602161246336640,
  28. "ScanType": 0,
  29. "UserId": "1004"
  30. }
  31. ]
  32. }
  33.  
  34. SELECT c.Code, b.TimeStamp FROM c JOIN b IN c.ScanLog ORDER BY b.TimeStamp
  35.  
  36. Order-by over correlated collections is not supported.
  37.  
  38. function sortScanLog (scanLog) {
  39. function compareTimeStamps(a, b) {
  40. return a.TimeStamp - b.TimeStamp;
  41. }
  42. return scanLog.sort(compareTimeStamps);
  43. }
  44.  
  45. SELECT c.ProductId, udf.sortScanLog(c.ScanLog) as ScanLog FROM c
  46.  
  47. function compareTimeStamps(b, a)
Add Comment
Please, Sign In to add comment