Need help with sql report
Hi SQL Guru's,
I need to create a report that shows the results of SCAP scans from the K1000. I have this so far for my sql code but it is returning way more records than there should be. Can anyone take a look and see what I have done wrong? Thanks in advance.
SELECT
MACHINE.NAME AS COMPUTER,
SCAP_PROFILE.TITLE,
SCAP_RESULT.RESULT_VALUE,
SCAP_RESULT_RULE.RULE_IDREF,
SCAP_GROUP.TITLE
FROM MACHINE,SCAP_PROFILE,SCAP_RESULT,SCAP_BENCHMARK,SCAP_RESULT_RULE,SCAP_GROUP
WHERE
SCAP_RESULT.MACHINE_ID = MACHINE.ID
AND
SCAP_RESULT.SCAP_PROFILE_ID = SCAP_PROFILE.ID
AND
SCAP_RESULT_RULE.SCAP_RESULT_ID = SCAP_RESULT.ID
AND
SCAP_PROFILE.SCAP_BENCHMARK_ID = SCAP_BENCHMARK.ID
AND
SCAP_GROUP.SCAP_PROFILE_ID = SCAP_PROFILE.ID
ORDER BY MACHINE.NAME
-
We are running 5.5.90546 of the k1000. - Timi 10 years ago
Answers (1)
Have you tried using JOIN instead of listing the tables after the FROM statement? e.g.: "FROM MACHINE INNER JOIN SCAP_PROFILE ON ..."
See http://dev.mysql.com/doc/refman/5.0/en/join.html for more details.