mardi 27 octobre 2015

Get names for IDs in two columns in one from another table

I have two tables:

CREATE TABLE tElements (
  elementID    INTEGER,
  name         TEXT,
  area         TEXT,
  zone         TEXT,
  voltageLevel TEXT,
  mRID         TEXT
);

CREATE TABLE tCAResults (
  timestamp          INTEGER NOT NULL,
  outageElementID    INTEGER NOT NULL,
  monitoredElementID INTEGER NOT NULL,
  preOutageLoading   DOUBLE  NOT NULL,
  postOutageLoading  DOUBLE  NOT NULL
);

How can I create query where id's of outageElementID and monitoredElementID from table tCAResult would be displayed as names from table tElements?

I have been searching for a whole day but couldn't find the answer. The closest I found is this but can't work it out

Aucun commentaire:

Enregistrer un commentaire