I have the SQLite database containing four arrays:
CREATE TABLE IF NOT EXISTS EVENTS_LIST
(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
DATE TEXT,
WORKER INTEGER,
EVENT INTEGER,
REGISTRATION_METHOD INTEGER)
CREATE TABLE IF NOT EXISTS WORKERS
(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
WORKER TEXT)
CREATE TABLE IF NOT EXISTS EVENTS
(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
EVENT TEXT)
CREATE TABLE IF NOT EXISTS REGISTRATION
(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
REGISTRATION_METHOD TEXT)
I need to get the following ID's: Worker, Event and Registration replaced with the name attached to this ID in the appropriate table.
Example:
3 Workers: 0001) John 0002) Tom 0003) Mike
3 Types of registration: 0) PIN 1) Fingerprint 2) NFC Card
3 Types of events: 1) came in 2) came out 3) came out on business
I get:
DATE | WORKER | EVENT | REGISTRATION
XXXX | 0001 | 1 | 0
XXXX | 0003 | 2 | 1
I need:
DATE | WORKER | EVENT | REGISTRATION
XXXX | John | came in | PIN
XXXX | Mike | came out | Fingerprint
I found those solutions:
How to replace fetched values with another column while querying with SQL Server 2008 R2
Multiple column SQL joins in a table
The first link is very similar but related only to one column and the second link is more complicated but has a few "LEFT OUTER JOIN" commands which seems to be the good direction.
Can anybody give me directions on how to accomplish this?