Example (for OCS >=2.8) :
select h.deviceid, h.name, sn.name, sv.version, s.commentsinto 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 svwhere s.hardware_id=h.id and sn.id=s.name_id and sv.id=s.version_id and h.archive is nullorder by h.name, sn.name, sv.version