今朝このコードが機能していて、昼食に行ったところ、正しい結果が表示されませんでした。表示されるはずの正しい行数が表示されていますが、結果はすべて最初の行の複製です。
SELECT
client_main.serial,
client_main.make,
client_main.model,
client_deploy.ticket,
client_deploy.techID,
client_deploy.installDate,
client_deploy.updateDate,
client_main.status,
client_main.type,
client_software.operating,
client_software.operating_license,
client_profile.buildID,
client_profile.department,
client_main.warrentyStart,
client_main.warrentyEnd,
client_hardware.cpu,
client_hardware.memory,
client_hardware.diskSpace1,
client_hardware.diskSpace2,
client_hardware.diskSpace3,
client_software.antivirus,
client_software.antivirus_version,
client_software.office,
client_software.office_license
FROM
client_main,
client_deploy,
client_hardware,
client_network,
client_profile,
client_software
WHERE client_main.id = client_deploy.id
AND client_deploy.id = client_hardware.id
AND client_hardware.id = client_profile.id
AND client_profile.id = client_software.id
アップデート:
指摘されたエラーに従ってコードを修正しました。現在、クエリは 1 つの結果のみを表示しています。
SELECT client_main.serial, client_main.make, client_main.model, client_deploy.ticket, client_main.status, client_software.operating, client_profile.username, client_hardware.cpu, client_hardware.diskSpace3, client_software.antivirus, client_network.ip
FROM client_main
inner join client_deploy on client_deploy.id = client_main.id
inner join client_hardware on client_hardware.id = client_main.id
inner join client_network on client_network.id = client_main.id
inner join client_profile on client_profile.id = client_main.id
inner join client_software on client_software.id = client_main.id
サンプル結果:
serial make model ticket status operating username cpu diskSpace3 antivirus ip
123 Delld Lattitude1 654897 2 4 dhenning1 13 13 4 2
ソリューション クエリ:
SELECT client_main.serial, client_deploy.ticket, client_software.operating, client_profile.username, client_hardware.cpu, client_network.ip
FROM client_main
INNER JOIN client_deploy ON client_deploy.id = client_main.id
INNER JOIN client_hardware ON client_hardware.id = client_main.id
INNER JOIN client_profile ON client_profile.id = client_main.id
INNER JOIN client_network ON client_network.id = client_main.id
INNER JOIN client_software ON client_software.id = client_main.id