Using CASE statement in a SELECT
Posted: Mon 19 Aug 2013 14:39
I'm having a problem getting the data from the following SQL CASE statement to show
properly in a TDBGrid:
SELECT Stamp,CatID,
(CASE WHEN CatID = 0 THEN 'Info'
WHEN CatID = 1 THEN 'Warning'
WHEN CatID = 2 THEN 'Error'
WHEN CatID = 3 THEN 'Debug'
END) AS Category,
Message
FROM LogEntries
Problem: The newly created field 'Category' displays '(MEMO)' for its data
rather than the text.
Displays properly when run using 'SQLite Expert'
Any ideas?
Thanks
properly in a TDBGrid:
SELECT Stamp,CatID,
(CASE WHEN CatID = 0 THEN 'Info'
WHEN CatID = 1 THEN 'Warning'
WHEN CatID = 2 THEN 'Error'
WHEN CatID = 3 THEN 'Debug'
END) AS Category,
Message
FROM LogEntries
Problem: The newly created field 'Category' displays '(MEMO)' for its data
rather than the text.
Displays properly when run using 'SQLite Expert'
Any ideas?
Thanks