时间:2010-10-19 17:33:36

标签: android sqlite

sql语句是:

SELECT 'customer_address'._id, 'address'.Descriptor AS Name 
FROM 'customer_address' 
INNER JOIN 'address' ON 'customer_address'.AddressID='address'._id
WHERE 'customer_address'.CustomerID=4 ORDER BY Name

当我使用adb sqlite shell检查数据库时,它报告地址表的模式是:

CREATE TABLE address (
  _id INTEGER PRIMARY KEY AUTOINCREMENT,
  EntityID INTEGER NOT NULL,
  TypeID INTEGER NOT NULL,
  Address VARCHAR(256) DEFAULT NULL,
  City VARCHAR(32) NOT NULL,
  Region VARCHAR(24) DEFAULT NULL,
  PostalCode VARCHAR(12) DEFAULT NULL,
  Country VARCHAR(30) NOT NULL,
  Descriptor VARCHAR(512) NOT NULL,
  Memo VARCHAR(1024) DEFAULT NULL,
  `Profile` VARCHAR(64) DEFAULT NULL,
  TofP DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP)

并且对于customer_address视图是:

CREATE VIEW customer_address 
AS select address._id AS _id,corporation.CustomerID AS CustomerID,address._id AS AddressID 
from (corporation join address on((corporation.EntityID = address.EntityID))) 
where (corporation.CustomerID is not null)

有人能看到错误吗?

日Thnx

0 个答案:

没有答案