Example (for OCS >=2.8) :
select h.deviceid, h.name, sn.name, sv.version, s.comments
into outfile '/tmp/export.csv'
fields terminated by ',' optionally enclosed by '"'
lines terminated by '\n'
from hardware as h, software as s, software_name as sn, software_version as sv
where s.hardware_id=h.id and sn.id=s.name_id and sv.id=s.version_id and h.archive is null
order by h.name, sn.name, sv.version