Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare 2 Tables

Status
Not open for further replies.

ashishsmith

Programmer
Jun 23, 2004
46
US
I am using Ms Access Database but assume SQL Query Language is always same, whatever it is; here is my query:

Code:
UPDATE feb
SET ID=march.ID,
[Scan Group]=march.[Scan Group],
[Scan Date]=march.[Scan Date],
[Vuln ID]=march.[Vuln ID],
CVE=march.CVE,
Vulnerability=march.Vulnerability,
Summary=march.Summary,
Description=march.Description,
[Risk Level]=march.[Risk Level],
IP=march.IP,
Hostname=march.Hostname,
[O/S]=march.[O/S],
Recommendation=march.Recommendation,
[Original Date]=march.[Original Date],
Age=march.Age,
Status=march.Status,
[Target O/S]=march.[Target O/S],
[Target App]=march.[Target App]

FROM feb JOIN march ON  feb.Vulnerabilities=march.Vulnerabilities
AND feb.[Risk Level] = march.[Risk Level]
AND feb.IP=march.IP
AND feb.[Original Date] = march.[Original Date];

When I try to save or execute this query, it says syntax error ('Missing Operator')

Can Somebody help me with this query? I am trying to update a table with data from another table with the same structure. What I wanted to actually do is append records from one table to another but if unique 4 fields are same than I want to overwrite it with the new data. Its just deleting old stuff if it is similiar and continue appending the old one. The above code is 1st half to update but that doesn't work.


Thank you,

Ashish Smith
 
Code:
UPDATE feb
SET ID=march.ID,
[Scan Group]=march.[Scan Group],
[Scan Date]=march.[Scan Date],
[Vuln ID]=march.[Vuln ID],
CVE=march.CVE,
Vulnerability=march.Vulnerability,
Summary=march.Summary,
Description=march.Description,
[Risk Level]=march.[Risk Level],
IP=march.IP,
Hostname=march.Hostname,
[O/S]=march.[O/S],
Recommendation=march.Recommendation,
[Original Date]=march.[Original Date],
Age=march.Age,
Status=march.Status,
[Target O/S]=march.[Target O/S],
[Target App]=march.[Target App]

FROM feb JOIN march ON  feb.Vulnerabilities=march.Vulnerabilities
AND feb.[Risk Level] = march.[Risk Level]
AND feb.IP=march.IP
AND feb.[Original Date] = march.[Original Date];

 
sorry quick fingers note misssing word
Code:
UPDATE feb
SET ID=march.ID,
[Scan Group]=march.[Scan Group],
[Scan Date]=march.[Scan Date],
[Vuln ID]=march.[Vuln ID],
CVE=march.CVE,
Vulnerability=march.Vulnerability,
Summary=march.Summary,
Description=march.Description,
[Risk Level]=march.[Risk Level],
IP=march.IP,
Hostname=march.Hostname,
[O/S]=march.[O/S],
Recommendation=march.Recommendation,
[Original Date]=march.[Original Date],
Age=march.Age,
Status=march.Status,
[Target O/S]=march.[Target O/S],
[Target App]=march.[Target App]

FROM feb [b][COLOR=red] inner [/color red][/b]JOIN march ON  feb.Vulnerabilities=march.Vulnerabilities
AND feb.[Risk Level] = march.[Risk Level]
AND feb.IP=march.IP
AND feb.[Original Date] = march.[Original Date];
 
This was the same code, I was suggested before, but It's not working and the error goes like this:

Syntax error (missing operator) in query expression 'march.[Target App]

FROM feb JOIN march ON feb.Vulnerabilities=march. Vulnerabilities AND............And feb.[Original Date]=march.[Original Date]'.


This doesn't work, do we have any other ideas?

Thank you,

Ashish Smith
 
Your error message pointed it out.
Code:
Status=march.Status,
[Target O/S]=march.[Target O/S],
[COLOR=red]feb.[/color][Target App]=march.[Target App]

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Forget that - I'm not awake today. [blush]


Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
UPDATE feb INNER JOIN march ON feb.Vulnerabilities=march.Vulnerabilities
AND feb.[Risk Level] = march.[Risk Level]
AND feb.IP=march.IP
AND feb.[Original Date] = march.[Original Date]
SET feb.ID=march.ID,
feb.[Scan Group]=march.[Scan Group],
feb.[Scan Date]=march.[Scan Date],
feb.[Vuln ID]=march.[Vuln ID],
feb.CVE=march.CVE,
feb.Vulnerability=march.Vulnerability,
feb.Summary=march.Summary,
feb.Description=march.Description,
feb.[Risk Level]=march.[Risk Level],
feb.IP=march.IP,
feb.Hostname=march.Hostname,
feb.[O/S]=march.[O/S],
feb.Recommendation=march.Recommendation,
feb.[Original Date]=march.[Original Date],
feb.Age=march.Age,
feb.Status=march.Status,
feb.[Target O/S]=march.[Target O/S],
feb.[Target App]=march.[Target App]
;

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top