Modifies the table structure by adding a new column.
Syntax:
ALTER TABLE table_name ADD COLUMN new_column_name = { sql_expression}
Example:
ALTER TABLE customer
ADD COLUMN customerType = {CASE WHEN "Source Type"=1 THEN 'Retail' ELSE 'Wholesale' END}
ALTER TABLE tStageCustLedgerEntry
ADD COLUMN wAgingBucket =
{
IIF([Open]=0 AND [wRemainingAmountLCY]<>0,
CASE
WHEN [wAgingDaysOverdue] <= 0 THEN 0
WHEN [wAgingDaysOverdue] > 0 AND [wAgingDaysOverdue] <= 30 THEN 30
WHEN [wAgingDaysOverdue] > 30 AND [wAgingDaysOverdue] <= 60 THEN 60
WHEN [wAgingDaysOverdue] > 61 AND [wAgingDaysOverdue] <= 90 THEN 90
WHEN [wAgingDaysOverdue] > 90 THEN 120
ELSE 0
END,
0)
}
Comments
Please sign in to leave a comment.