Not equal?

sasolini

Registered User.
Local time
Today, 09:57
Joined
Dec 27, 2004
Messages
61
Hey,

I have 2 tables that i compere together with a query and if my criteria is OK than selected data is recordet in new table with some calculation....code:

Code:
INSERT INTO tblZaloga ( Proizvajalec, Tip, DN, Predvideno, Naroceno, Zaloga )
SELECT tblACAD_Urejeno.Proizvajalec, tblACAD_Urejeno.Tip, tblACAD_Urejeno.DN, tblACAD_Urejeno.KosovSkupaj, tblIN_Urejeno.KosovSkupaj, Sum(([tblIN_Urejeno].[KosovSkupaj]-[tblACAD_Urejeno].[KosovSkupaj])) AS Zaloga
FROM tblACAD_Urejeno, tblIN_Urejeno
WHERE (((tblACAD_Urejeno.Tip)=[tblIN_Urejeno].[tip]) AND ((tblACAD_Urejeno.DN)=[tblIN_Urejeno].[DN]))
GROUP BY tblACAD_Urejeno.Proizvajalec, tblACAD_Urejeno.Tip, tblACAD_Urejeno.DN, tblACAD_Urejeno.KosovSkupaj, tblIN_Urejeno.KosovSkupaj;


Now i have a problem with racords that does not reach my criteria. The problem is that i dont know witch records are the one that does not reach my criterya? Can someone pls tell me how can i create a table like the code up there but with records that are not procesed?

THX
 
You need to use JOINS. Check them out in Access Help.

Select tblACAD_Urejeno.tip, tblIN_Urejeno.tip
FROM tblACAD_Urejeno
LEFT JOIN tblIN_Urejeno ON tblACAD_Urejeno.Tip=[tblIN_Urejeno].[tip] AND tblACAD_Urejeno.DN=[tblIN_Urejeno].[DN]
WHERE [tblIN_Urejeno].[tip] IS NULL

Will return all of the records in tblACAD_Urejeno and only the matching records in tblIN_Urejeno

Select tblACAD_Urejeno.tip, tblIN_Urejeno.tip
FROM tblACAD_Urejeno
RIGHT JOIN tblIN_Urejeno ON tblACAD_Urejeno.Tip=[tblIN_Urejeno].[tip] AND tblACAD_Urejeno.DN=[tblIN_Urejeno].[DN]
WHERE [tblACAD_Urejeno].[tip] IS NULL

Will do just the opposite.
 
thx man..looks like i learn somethink new ;)
 

Users who are viewing this thread

Back
Top Bottom