FatPap

how to join 3 sqlite tables?

Mar 25th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. I want to join 3 tables from my database:
  2.  
  3. table checklog:
  4. MacAdress timestamp result user
  5. 4C626D3BB6D4 1394 1 frank
  6. 4C626D3BB6D4 1395 0 dave
  7.  
  8. table service:
  9. MacAdress timestamp text
  10. 5C626D3BB6D5 1396 test
  11.  
  12. table error:
  13. MacAdress timestamp error1 error2 errortext
  14. 4C626D3BB6D4 1397 0 0 OK
  15.  
  16. Result should be:
  17. MacAdress timestamp result user text error1 error2 errortext
  18. 4C626D3BB6D4 1394 1 frank
  19. 4C626D3BB6D4 1395 0 dave
  20. 5C626D3BB6D5 1396 test
  21. 4C626D3BB6D4 1397 0 0 OK
  22.  
  23. What SQLite command should i use to get the above result?
  24.  
  25. The database structure is as follows:
  26. CREATE TABLE [checklog](
  27. [MacAdress] TEXT NOT NULL ,
  28. [timestamp] INTEGER NOT NULL ,
  29. [result] INTEGER ,
  30. [user] TEXT ,
  31. CONSTRAINT [sqlite_autoindex_checklog_1] PRIMARY KEY
  32. ( [MacAdress], [timestamp] ));
  33. CREATE TABLE [error](
  34. [MacAdress] TEXT NOT NULL ,
  35. [timestamp] INTEGER NOT NULL ,
  36. [error1] INTEGER ,
  37. [error2] INTEGER ,
  38. [errortext] TEXT ,
  39. CONSTRAINT [sqlite_autoindex_error_1] PRIMARY KEY
  40. ( [MacAdress], [timestamp] ));
  41. CREATE TABLE [service](
  42. [MacAdress] TEXT NOT NULL ,
  43. [timestamp] INTEGER NOT NULL ,
  44. [text] TEXT ,
  45. CONSTRAINT [sqlite_autoindex_service_1] PRIMARY KEY
  46. ( [MacAdress], [timestamp] ));
Advertisement
Add Comment
Please, Sign In to add comment