sql - SQLite conditional output -
i need output x in column in report created using sqlite.
i need find patern, , if pattern exsists record output x, if not found output blank space.
heres have.
select `device_type` "device", substr(`model`, 1, 30) "model",   `location` "location",   (case when (`user_tag` "%decommissioned%" "x" else " " end) "decom",   count(`id`) "count" `devices` group `device_type` order `device` asc;   its reporting
near "then": syntax error   like said, can use sql putting report together. little limiting im allowed use this.
thanks in advance help.
i think right syntax:
select `device_type` device,        substr(`model`, 1, 30) model,        `location` "location",         (case when `user_tag` "%decommissioned%" "x" else " " end) "decom",         count(`id`) "count" `devices` group device_type, substr(`model`, 1, 30), location,          (case when `user_tag` "%decommissioned%" "x" else " " end) order `device` asc;   you have opening paren.  in addition, group by clause not match select in terms of columns being used define groups.
Comments
Post a Comment