mysql - SQL Code displaying duplicate results -


had code working morning, went lunch, , not displaying correct results. displaying correct amount of rows supposed show up, of results duplicates of first row.

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      client_main,      client_deploy,      client_hardware,      client_network,      client_profile,      client_software client_main.id = client_deploy.id     , client_deploy.id = client_hardware.id     , client_hardware.id = client_profile.id     , client_profile.id = client_software.id 

update:

fixed code according errors pointed out. query showing single result.

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  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 

sample result:

serial  make    model   ticket  status  operating   username    cpu diskspace3  antivirus   ip 123 delld   lattitude1  654897  2   4   dhenning1   13  13  4   2 

solution query:

select client_main.serial, client_deploy.ticket, client_software.operating, client_profile.username, client_hardware.cpu, client_network.ip 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 

without knowing schema:

from client_main, client_deploy, client_hardware,         client_network, client_profile, client_software 

you selecting six different tables, joining against four

where client_main.id = client_deploy.id     , client_deploy.id = client_hardware.id     , client_hardware.id = client_profile.id     , client_profile.id = client_software.id 

you missing few joins, why getting duplicate results.


Comments