本文介绍了没有这样的列:R1.ReadingDate错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建使用SQLite经理源码视图。

I have created a view in sqlite using sqlite manager.

Create View vMeterReading
as
SELECT M._id as Meter_id, M.MeterNumber, R1.ReadingDate, R1.Reading AS              CurrentReading, R2.ReadingDate AS PrevReadingDate, R2.Reading AS PrevMeterReading, R2.Rate  as Rate, R2._id,R1.TenantMeter_id
FROM (Meters AS M INNER JOIN TenantMeters ON M._id = TenantMeters.Meter_id) INNER JOIN (MeterReading AS R1 INNER JOIN MeterReading AS R2 ON R1.TenantMeter_id = R2.TenantMeter_id) ON TenantMeters._id = R1.TenantMeter_id
WHERE (((R2.ReadingDate)=(SELECT Max(R3.ReadingDate)
      FROM [MeterReading] AS R3
      WHERE (R3.TenantMeter_id = R1.TenantMeter_id)
        AND (R3.ReadingDate < R1.ReadingDate)
    ))) OR (((R2.TenantMeter_id) Is Null))
ORDER BY M.MeterNumber, R1.ReadingDate.

我曾尝试使用此视图( SELECT * FROM vMeterReading )的Andr​​oid和我得到的标题错误。

I have tried to use this view (select * from vMeterReading) in android and I get the error as titled.

我也连接到从命令提示符下sqlite的分贝,并试图执行相同的查询。我得到了同样的错误。

I have also connected to the sqlite db from command prompt and tried to execute the same query. I get the same error.

什么是错的sql语句?

What is wrong with the sql statement?

它运作良好,在SQL管理器(Firefox插件)。

It works well in sql manager(firefox add-on).

推荐答案

问题是由Android使用SQLite的版本是不一样的SQLite的由管理器使用的版本。 Android版本不支持我使用的连接。
下面的查询执行与出的问题。
得到这个网站这个建议

The problem was that the SQLite version used by android is not the same as the version used by sQLite manager. The android version does not support the join i was using.The query below executes with out problems.Got this advice from this site http://sqlite.1065341.n5.nabble.com/

SELECT M._id as Meter_id, M.MeterNumber, R1.ReadingDate as ReadingDate,
R1.Reading AS CurrentReading, R2.ReadingDate AS PrevReadingDate, R2.Reading
AS PrevMeterReading, R2.Rate as Rate, R2._id as _id,R1.TenantMeter_id as TenantMeterID
FROM Meters AS M INNER JOIN TenantMeters ON M._id = TenantMeters.Meter_id
INNER JOIN MeterReading AS R1 ON R1.TenantMeter_id = TenantMeters ._id
 INNER JOIN MeterReading AS R2 ON
R1.TenantMeter_id = R2.TenantMeter_id

WHERE (((R2.ReadingDate)=(SELECT Max(R3.ReadingDate)
      FROM [MeterReading] AS R3
      WHERE (R3.TenantMeter_id = R1.TenantMeter_id)
        AND (R3.ReadingDate < R1.ReadingDate)
    ))) OR (((R2.TenantMeter_id) Is Null))

这篇关于没有这样的列:R1.ReadingDate错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 06:20