0
當我嘗試創建動態列時,出現以下錯誤。我認爲這是合法的,但顯然Android和SQLite不喜歡這樣。我確定我錯過了一些簡單的事情,但我無法回想起來。當我嘗試利用我在這裏創建的SQLite數據庫時,Android發生了以下情況:
錯誤消息是:沒有這樣的列:sundayResult:,在編譯:
, sunday || ' ' ||
代替:
CREATE TABLE DAYSUSED(
_id INTEGER PRIMARY KEY autoincrement,
sunday INTEGER NOT NULL,
monday INTEGER NOT NULL,
tuesday INTEGER NOT NULL,
wednesday INTEGER NOT NULL,
thursday INTEGER NOT NULL,
friday INTEGER NOT NULL,
saturday INTEGER NOT NULL);
SELECT _id
, volume_level
, vibrate
, CASE WHEN sunday = 1 THEN 'Sun' ELSE ' ' END AS sundayResult
, CASE WHEN monday = 1 THEN 'Mon' ELSE ' ' END AS mondayResult
, CASE WHEN tuesday = 1 THEN 'Tues' ELSE ' ' END AS tuesdayResult
, CASE WHEN wednesday = 1 THEN 'Wed' ELSE ' ' END AS wednesdayResult
, CASE WHEN thursday = 1 THEN 'Thur' ELSE ' ' END AS thursdayResult
, CASE WHEN friday = 1 THEN 'Fri' ELSE ' ' END AS fridayResult
, CASE WHEN saturday = 1 THEN 'Sat' ELSE ' ' END AS saturdayResult
, sundayResult || ' ' || mondayResult || ' ' || tuesdayResult || ' ' || wednesdayResult || ' ' || thursdayResult || ' ' || fridayResult || ' ' || saturdayResult || ' ' AS days_of_week
FROM DAYSUSED
,如果我做一個直接調用的實際列像最後一行將工作我現在有哪些是:
, sundayResult || ' ' ||
我已經看了所有,不知道什麼ELS í嘗試,因爲我真的想改變光標的數據。
感謝, 凱利
非常感謝您的幫助。正如我看到你的解決方案,我開始認爲我可能不得不做一個CTE或JOIN。 – KellyTheDev 2011-04-14 00:13:21