Запрос:
SELECT 'customer_rep'._id AS _id, 'person'.Descriptor AS Name
FROM 'customer_rep' INNER JOIN 'rep' ON 'customer_rep'.RepID='rep'._id
INNER JOIN 'person' ON 'rep'.PersonID='person'._id
WHERE 'customer_rep'.CustomerID='4' ORDER BY Name
'customer_rep'
- это представление, созданное следующим образом:
CREATE VIEW customer_rep AS select rep._id AS _id,corporation.CustomerID AS CustomerID,rep._id AS RepID from (rep join corporation on((corporation._id = rep.CorporationID)))
WHERE(corporation.CustomerID is not null)
Сообщение об ошибке sql гласит: такого столбца нет: rep._id: при компиляции:
SELECT 'customer_rep'._id AS _id, 'person'.Descriptor AS Name
FROM 'customer_rep'
INNER JOIN 'rep' ON 'customer_rep'.RepID='rep'._id
INNER JOIN 'person' ON 'rep'.PersonID='person'._id
WHERE 'customer_rep'.CustomerID='4' ORDER BY Name
Создание stmnt для таблицы 'rep'
:
CREATE TABLE rep (
_id INTEGER PRIMARY KEY AUTOINCREMENT,
CorporationID INTEGER NOT NULL,
PersonID INTEGER NOT NULL,
Title VARCHAR(32) DEFAULT NULL,
Memo VARCHAR(64) DEFAULT NULL,
`Profile` VARCHAR(64) DEFAULT NULL,
TofP DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP)
Будут оценены любые мысли ...