此查询返回包含操作系统信息的两个单独的列,因为数据是基于扫描工具自动写入数据库表的,我无法手动更改列。我正在尝试编写一个将两行合并为一的查询(使用 operating_system_version 行中的数据填充操作系统行中的空白。
我现在的查询如下:
SELECT device_type, operating_system, operating_system_version
FROM DEVICES
WHERE user_name like '|%front-%|'
OR user_name like '|%back-%|'
OR user_name like '|%ap-%|'
OR user_name like '|%me-%|'
OR user_name like '|%mg-%|'
它返回:
device_type operating_system operating_system_version
desktop windows xp
desktop windows 7 professional
desktop windows xp
desktop windows 7 professional
我希望它返回如下内容:
device_type OS
desktop windows xp
desktop windows 7 professional
desktop windows xp
desktop windows 7 professional
我试过添加|| 如下所示,但它没有返回数据:
SELECT device_type, operating_system||operating_system_version
FROM DEVICES
WHERE user_name like '|%front-%|'
OR user_name like '|%back-%|'
OR user_name like '|%ap-%|'
OR user_name like '|%me-%|'
OR user_name like '|%mg-%|'