此SQL查询在SQLite Manager中有效,但在2.1-1 Emulator中无效

时间:2011-04-21 15:07:55

标签: android sqlite

查询:

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

'rep'表的创建stmnt是:

  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)

任何想法都将受到赞赏......

0 个答案:

没有答案